// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/Constants.java
// public class Constants {
//     public static final String[] VIDEO_COLUMNS = {
//             VideoContract.Videos.TABLE_NAME + "." + VideoContract.Videos._ID,
//             VideoContract.Videos.TITLE,
//             VideoContract.Videos.DESCRIPTION,
//             VideoContract.Videos.LINK,
//             VideoContract.Videos.THUMBNAIL_URL
//     };
//     public static final int COL_TITLE = 1;
//     public static final int COL_DESCRIPTION = 2;
//     public static final int COL_LINK = 3;
//     public static final int COL_THUMBNAIL_URL = 4;
//     public static String XMLFileName = "video_content.xml";
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/DataUtils.java
// public class DataUtils {
// 
//     public static String[] readTitleAuthor() {
//         String result[] = new String[2];
//         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// 
//         dbf.setValidating(false);
// 
//         DocumentBuilder db;
//         Document doc;
//         try {
//             File fXmlFile = new File(Constants.XMLFileName);
//             db = dbf.newDocumentBuilder();
//             doc = db.parse(fXmlFile);
//             doc.normalize();
// 
//             result[0] = doc.getElementsByTagName("title").item(0).getChildNodes()
//                     .item(0).getNodeValue();
// 
//             result[1] = doc.getElementsByTagName("name").item(0).getChildNodes()
//                     .item(0).getNodeValue();
// 
//         } catch (ParserConfigurationException | SAXException | IOException e) {
//             e.printStackTrace();
//         }
//         return result;
//     }
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/VideoContract.java
// public class VideoContract {
// 
//     public static final class Videos implements BaseColumns {
// 
//         public static final String TABLE_NAME = "videos";
// 
//         public static final String TITLE = "title";
//         public static final String DESCRIPTION = "description";
//         public static final String LINK = "link";
//         public static final String THUMBNAIL_URL = "thumbnail_url";
// 
//     }
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/VideoModel.java
// public class VideoModel implements Parcelable {
//     public final static Parcelable.Creator<VideoModel> CREATOR = new Parcelable.Creator<VideoModel>() {
//         @Override
//         public VideoModel createFromParcel(Parcel parcel) {
//             return new VideoModel(parcel);
//         }
// 
//         @Override
//         public VideoModel[] newArray(int size) {
//             return new VideoModel[size];
//         }
//     };
// 
//     private String title;
//     private String description;
//     private String link;
//     private String thumbnail_url;
// 
//     public VideoModel() {
//     }
// 
//     private VideoModel(Parcel in) {
//         this.title = in.readString();
//         this.description = in.readString();
//         this.link = in.readString();
//         this.thumbnail_url = in.readString();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(title);
//         dest.writeString(description);
//         dest.writeString(link);
//         dest.writeString(thumbnail_url);
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getThumbnailUrl() {
//         return thumbnail_url;
//     }
// 
//     public void setThumbnailUrl(String thumbnail_url) {
//         this.thumbnail_url = thumbnail_url;
//     }
// 
//     public String getLink() {
//         return link;
//     }
// 
//     public void setLink(String link) {
//         this.link = link;
//     }
// 
// }


import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.videocollectiontemplate.Constants;
import org.buildmlearn.toolkit.videocollectiontemplate.adapter.VideoArrayAdapter;
import org.buildmlearn.toolkit.videocollectiontemplate.data.DataUtils;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoContract;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoDb;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoModel;
import java.util.ArrayList;
package org.buildmlearn.toolkit.videocollectiontemplate.fragment;




/**
 * @brief Fragment containing list of videos in video collection template's simulator.
 * <p/>
 * Created by Anupam (opticod) on 20/5/16.
 */
public class MainActivityFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {

    private static final String SELECTED_KEY = "selected_position";
    private static final int VIDEO_LOADER = 0;

    private VideoArrayAdapter videoListAdapter;
    private int mPosition = ListView.INVALID_POSITION;
    private ListView listView;
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/Constants.java
// public class Constants {
//     public static final String[] VIDEO_COLUMNS = {
//             VideoContract.Videos.TABLE_NAME + "." + VideoContract.Videos._ID,
//             VideoContract.Videos.TITLE,
//             VideoContract.Videos.DESCRIPTION,
//             VideoContract.Videos.LINK,
//             VideoContract.Videos.THUMBNAIL_URL
//     };
//     public static final int COL_TITLE = 1;
//     public static final int COL_DESCRIPTION = 2;
//     public static final int COL_LINK = 3;
//     public static final int COL_THUMBNAIL_URL = 4;
//     public static String XMLFileName = "video_content.xml";
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/DataUtils.java
// public class DataUtils {
// 
//     public static String[] readTitleAuthor() {
//         String result[] = new String[2];
//         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// 
//         dbf.setValidating(false);
// 
//         DocumentBuilder db;
//         Document doc;
//         try {
//             File fXmlFile = new File(Constants.XMLFileName);
//             db = dbf.newDocumentBuilder();
//             doc = db.parse(fXmlFile);
//             doc.normalize();
// 
//             result[0] = doc.getElementsByTagName("title").item(0).getChildNodes()
//                     .item(0).getNodeValue();
// 
//             result[1] = doc.getElementsByTagName("name").item(0).getChildNodes()
//                     .item(0).getNodeValue();
// 
//         } catch (ParserConfigurationException | SAXException | IOException e) {
//             e.printStackTrace();
//         }
//         return result;
//     }
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/VideoContract.java
// public class VideoContract {
// 
//     public static final class Videos implements BaseColumns {
// 
//         public static final String TABLE_NAME = "videos";
// 
//         public static final String TITLE = "title";
//         public static final String DESCRIPTION = "description";
//         public static final String LINK = "link";
//         public static final String THUMBNAIL_URL = "thumbnail_url";
// 
//     }
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/VideoModel.java
// public class VideoModel implements Parcelable {
//     public final static Parcelable.Creator<VideoModel> CREATOR = new Parcelable.Creator<VideoModel>() {
//         @Override
//         public VideoModel createFromParcel(Parcel parcel) {
//             return new VideoModel(parcel);
//         }
// 
//         @Override
//         public VideoModel[] newArray(int size) {
//             return new VideoModel[size];
//         }
//     };
// 
//     private String title;
//     private String description;
//     private String link;
//     private String thumbnail_url;
// 
//     public VideoModel() {
//     }
// 
//     private VideoModel(Parcel in) {
//         this.title = in.readString();
//         this.description = in.readString();
//         this.link = in.readString();
//         this.thumbnail_url = in.readString();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(title);
//         dest.writeString(description);
//         dest.writeString(link);
//         dest.writeString(thumbnail_url);
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getThumbnailUrl() {
//         return thumbnail_url;
//     }
// 
//     public void setThumbnailUrl(String thumbnail_url) {
//         this.thumbnail_url = thumbnail_url;
//     }
// 
//     public String getLink() {
//         return link;
//     }
// 
//     public void setLink(String link) {
//         this.link = link;
//     }
// 
// }


// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/fragment/MainActivityFragment.java
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.videocollectiontemplate.Constants;
import org.buildmlearn.toolkit.videocollectiontemplate.adapter.VideoArrayAdapter;
import org.buildmlearn.toolkit.videocollectiontemplate.data.DataUtils;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoContract;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoDb;
import org.buildmlearn.toolkit.videocollectiontemplate.data.VideoModel;
import java.util.ArrayList;

package org.buildmlearn.toolkit.videocollectiontemplate.fragment;




/**
 * @brief Fragment containing list of videos in video collection template's simulator.
 * <p/>
 * Created by Anupam (opticod) on 20/5/16.
 */
public class MainActivityFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {

    private static final String SELECTED_KEY = "selected_position";
    private static final int VIDEO_LOADER = 0;

    private VideoArrayAdapter videoListAdapter;
    private int mPosition = ListView.INVALID_POSITION;
    private ListView listView;
    private ArrayList<VideoModel> videoList;