// Path: app/src/main/java/in/sahildave/gazetti/homescreen/adapter/CellModel.java
// public class CellModel {
// 
//     private String newspaperImage;
//     private String newspaperTitle;
//     private String newspaperId;
//     private String categoryTitle;
//     private String categoryId;
// 
//     public CellModel(Newspapers newspapers, Category category) {
//         setNewspaperImage(newspapers.getNewspaperImage());
//         setNewspaperTitle(newspapers.getTitle());
//         setNewspaperId(newspapers.getNewspaperId());
// 
//         setCategoryTitle(category.getTitle());
//         setCategoryId(category.getCategoryId());
//     }
// 
//     public CellModel (NewsCatModel newsCatModel) {
//         setNewspaperImage(newsCatModel.getNewspaperImage());
//         setNewspaperTitle(newsCatModel.getNewspaperTitle());
//         setNewspaperId(newsCatModel.getNewspaperId());
// 
//         setCategoryTitle(newsCatModel.getCategoryTitle());
//         setCategoryId(newsCatModel.getCategoryId());
//     }
// 
//     public String getNewspaperImage() {
//         return newspaperImage;
//     }
// 
//     public void setNewspaperImage(String newspaperImage) {
//         this.newspaperImage = newspaperImage;
//     }
// 
//     public String getCategoryTitle() {
//         return categoryTitle;
//     }
// 
//     public void setCategoryTitle(String categoryTitle) {
//         this.categoryTitle = categoryTitle;
//     }
// 
//     public String getNewspaperTitle() {
//         return newspaperTitle;
//     }
// 
//     public void setNewspaperTitle(String newspaperTitle) {
//         this.newspaperTitle = newspaperTitle;
//     }
// 
//     public String getNewspaperId() {
//         return newspaperId;
//     }
// 
//     public void setNewspaperId(String newspaperId) {
//         this.newspaperId = newspaperId;
//     }
// 
//     public String getCategoryId() {
//         return categoryId;
//     }
// 
//     public void setCategoryId(String categoryId) {
//         this.categoryId = categoryId;
//     }
// 
//     @Override
//     public String toString() {
//         return getNewspaperId()+"-"+getNewspaperTitle()+", "+getCategoryId()+"-"+getCategoryTitle();
//     }
// 
// }
// 
// Path: app/src/main/java/in/sahildave/gazetti/util/GazettiEnums.java
// public enum Category {
//     NATIONAL ("National", "1"),
//     INTERNATIONAL ("International", "2"),
//     SPORTS ("Sports", "3"),
//     SCIENCE ("Science", "4"),
//     BUSINESS ("Business", "6"),
//     OPINION_BLOG_EDITORIAL("Blogs and Editorials", "7"),
//     ENTERTAINMENT ("Entertainment", "5"),
//     ADD_NEW("Add New", "-1");
// 
//     private final String categoryTitle;
//     private final String categoryId;
// 
//     Category(String categoryTitle, String catId) {
//         this.categoryTitle = categoryTitle;
//         this.categoryId = catId;
//     }
// 
//     public String getTitle() {
//         return categoryTitle;
//     }
// 
//     public String getCategoryId() {
//         return categoryId;
//     }
// }
// 
// Path: app/src/main/java/in/sahildave/gazetti/util/GazettiEnums.java
// public enum Newspapers {
//     THE_HINDU ("The Hindu", "th", "0", "hindu_data"),
//     TOI ("The Times of India", "toi", "1", "toi_data"),
//     FIRST_POST ("First Post", "fp", "2", "fp_data"),
//     INDIAN_EXP ("The Indian Express", "tie", "3", "tie_data"),
//     ADD_NEW ("Add New", "add_new", "-1", "null");
// 
//     private final String newspaperTitle;
//     private final String newspaperImage;
//     private final String newspaperId;
//     private final String dbToSearch;
// 
//     Newspapers(String newspaperTitle, String newspaperImage, String npId, String dbToSearch) {
//         this.newspaperTitle = newspaperTitle;
//         this.newspaperImage = newspaperImage;
//         this.newspaperId = npId;
//         this.dbToSearch = dbToSearch;
//     }
// 
//     public String getTitle() {
//         return newspaperTitle;
//     }
// 
//     public String getNewspaperImage() {
//         return newspaperImage;
//     }
// 
//     public String getNewspaperId() {
//         return newspaperId;
//     }
// }


import android.content.Context;
import in.sahildave.gazetti.homescreen.adapter.CellModel;
import in.sahildave.gazetti.util.GazettiEnums.Category;
import in.sahildave.gazetti.util.GazettiEnums.Newspapers;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
package in.sahildave.gazetti.util;



/**
 * Created by sahil on 9/11/14.
 */
public class UserPrefUtil {
    private static final String LOG_TAG = UserPrefUtil.class.getName();
    private static UserPrefUtil _instance = null;
    private Context context;

    public static synchronized UserPrefUtil getInstance(Context context){
        if (_instance == null) {
            _instance = new UserPrefUtil(context.getApplicationContext());
        }
        return _instance;
    }

    private UserPrefUtil(Context parentContext) {
        context = parentContext;
    }

    public List<CellModel> getUserPrefCellList(){

        List<CellModel> returnList = new ArrayList<CellModel>();
        Map<String, List<String>> userPrefMap = NewsCatFileUtil.getInstance(context).getUserSelectionMap();

        GazettiEnums gazettiEnums = new GazettiEnums();
        for (String newspaper : userPrefMap.keySet()) {
            List<String> categoriesSelected = userPrefMap.get(newspaper);
            Newspapers npEnum = gazettiEnums.getNewspaperFromName(newspaper);
            for (String category : categoriesSelected) {
// Path: app/src/main/java/in/sahildave/gazetti/homescreen/adapter/CellModel.java
// public class CellModel {
// 
//     private String newspaperImage;
//     private String newspaperTitle;
//     private String newspaperId;
//     private String categoryTitle;
//     private String categoryId;
// 
//     public CellModel(Newspapers newspapers, Category category) {
//         setNewspaperImage(newspapers.getNewspaperImage());
//         setNewspaperTitle(newspapers.getTitle());
//         setNewspaperId(newspapers.getNewspaperId());
// 
//         setCategoryTitle(category.getTitle());
//         setCategoryId(category.getCategoryId());
//     }
// 
//     public CellModel (NewsCatModel newsCatModel) {
//         setNewspaperImage(newsCatModel.getNewspaperImage());
//         setNewspaperTitle(newsCatModel.getNewspaperTitle());
//         setNewspaperId(newsCatModel.getNewspaperId());
// 
//         setCategoryTitle(newsCatModel.getCategoryTitle());
//         setCategoryId(newsCatModel.getCategoryId());
//     }
// 
//     public String getNewspaperImage() {
//         return newspaperImage;
//     }
// 
//     public void setNewspaperImage(String newspaperImage) {
//         this.newspaperImage = newspaperImage;
//     }
// 
//     public String getCategoryTitle() {
//         return categoryTitle;
//     }
// 
//     public void setCategoryTitle(String categoryTitle) {
//         this.categoryTitle = categoryTitle;
//     }
// 
//     public String getNewspaperTitle() {
//         return newspaperTitle;
//     }
// 
//     public void setNewspaperTitle(String newspaperTitle) {
//         this.newspaperTitle = newspaperTitle;
//     }
// 
//     public String getNewspaperId() {
//         return newspaperId;
//     }
// 
//     public void setNewspaperId(String newspaperId) {
//         this.newspaperId = newspaperId;
//     }
// 
//     public String getCategoryId() {
//         return categoryId;
//     }
// 
//     public void setCategoryId(String categoryId) {
//         this.categoryId = categoryId;
//     }
// 
//     @Override
//     public String toString() {
//         return getNewspaperId()+"-"+getNewspaperTitle()+", "+getCategoryId()+"-"+getCategoryTitle();
//     }
// 
// }
// 
// Path: app/src/main/java/in/sahildave/gazetti/util/GazettiEnums.java
// public enum Category {
//     NATIONAL ("National", "1"),
//     INTERNATIONAL ("International", "2"),
//     SPORTS ("Sports", "3"),
//     SCIENCE ("Science", "4"),
//     BUSINESS ("Business", "6"),
//     OPINION_BLOG_EDITORIAL("Blogs and Editorials", "7"),
//     ENTERTAINMENT ("Entertainment", "5"),
//     ADD_NEW("Add New", "-1");
// 
//     private final String categoryTitle;
//     private final String categoryId;
// 
//     Category(String categoryTitle, String catId) {
//         this.categoryTitle = categoryTitle;
//         this.categoryId = catId;
//     }
// 
//     public String getTitle() {
//         return categoryTitle;
//     }
// 
//     public String getCategoryId() {
//         return categoryId;
//     }
// }
// 
// Path: app/src/main/java/in/sahildave/gazetti/util/GazettiEnums.java
// public enum Newspapers {
//     THE_HINDU ("The Hindu", "th", "0", "hindu_data"),
//     TOI ("The Times of India", "toi", "1", "toi_data"),
//     FIRST_POST ("First Post", "fp", "2", "fp_data"),
//     INDIAN_EXP ("The Indian Express", "tie", "3", "tie_data"),
//     ADD_NEW ("Add New", "add_new", "-1", "null");
// 
//     private final String newspaperTitle;
//     private final String newspaperImage;
//     private final String newspaperId;
//     private final String dbToSearch;
// 
//     Newspapers(String newspaperTitle, String newspaperImage, String npId, String dbToSearch) {
//         this.newspaperTitle = newspaperTitle;
//         this.newspaperImage = newspaperImage;
//         this.newspaperId = npId;
//         this.dbToSearch = dbToSearch;
//     }
// 
//     public String getTitle() {
//         return newspaperTitle;
//     }
// 
//     public String getNewspaperImage() {
//         return newspaperImage;
//     }
// 
//     public String getNewspaperId() {
//         return newspaperId;
//     }
// }


// Path: app/src/main/java/in/sahildave/gazetti/util/UserPrefUtil.java
import android.content.Context;
import in.sahildave.gazetti.homescreen.adapter.CellModel;
import in.sahildave.gazetti.util.GazettiEnums.Category;
import in.sahildave.gazetti.util.GazettiEnums.Newspapers;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

package in.sahildave.gazetti.util;



/**
 * Created by sahil on 9/11/14.
 */
public class UserPrefUtil {
    private static final String LOG_TAG = UserPrefUtil.class.getName();
    private static UserPrefUtil _instance = null;
    private Context context;

    public static synchronized UserPrefUtil getInstance(Context context){
        if (_instance == null) {
            _instance = new UserPrefUtil(context.getApplicationContext());
        }
        return _instance;
    }

    private UserPrefUtil(Context parentContext) {
        context = parentContext;
    }

    public List<CellModel> getUserPrefCellList(){

        List<CellModel> returnList = new ArrayList<CellModel>();
        Map<String, List<String>> userPrefMap = NewsCatFileUtil.getInstance(context).getUserSelectionMap();

        GazettiEnums gazettiEnums = new GazettiEnums();
        for (String newspaper : userPrefMap.keySet()) {
            List<String> categoriesSelected = userPrefMap.get(newspaper);
            Newspapers npEnum = gazettiEnums.getNewspaperFromName(newspaper);
            for (String category : categoriesSelected) {
                Category catEnum = gazettiEnums.getCategoryFromName(category);