Android Open Source - Gazetti_Newspaper_Reader Gazetti Enums






From Project

Back to project page Gazetti_Newspaper_Reader.

License

The source code is released under:

MIT License

If you think the Android project Gazetti_Newspaper_Reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package in.sahildave.gazetti.util;
/* w w w  . java2  s  .  co  m*/
/**
 * Created by sahil on 9/11/14.
 */
public class GazettiEnums {

    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;
        }
    }

    public Newspapers getNewspaperFromImage(String newspaperImage){
        if (newspaperImage.equals("th")) {
            return Newspapers.THE_HINDU;
        } else if (newspaperImage.equals("toi")) {
            return Newspapers.TOI;
        } else if (newspaperImage.equals("fp")) {
            return Newspapers.FIRST_POST;
        } else if (newspaperImage.equals("tie")) {
            return Newspapers.INDIAN_EXP;
        }
        return null;
    }

    public Newspapers getNewspaperFromName(String newspaperName){
        if (newspaperName.equals("The Hindu")) {
            return Newspapers.THE_HINDU;
        } else if (newspaperName.equals("The Times of India")) {
            return Newspapers.TOI;
        } else if (newspaperName.equals("First Post")) {
            return Newspapers.FIRST_POST;
        } else if (newspaperName.equals("The Indian Express")) {
            return Newspapers.INDIAN_EXP;
        }
        return null;
    }

    //// Categories ////

    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;
        }
    }

    public Category getCategoryFromId(String catId){
        if (catId.equals("1")) {
            return Category.NATIONAL;
        } else if (catId.equals("2")) {
            return Category.INTERNATIONAL;
        } else if (catId.equals("3")) {
            return Category.SPORTS;
        } else if (catId.equals("4")) {
            return Category.SCIENCE;
        } else if (catId.equals("5")) {
            return Category.ENTERTAINMENT;
        } else if (catId.equals("6")) {
            return Category.BUSINESS;
        } else if (catId.equals("7")) {
            return Category.OPINION_BLOG_EDITORIAL;
        } else if (catId.equals("-1")) {
            return Category.ADD_NEW;
        }
        return null;
    }

    public Category getCategoryFromName(String categoryName){
        if (categoryName.equalsIgnoreCase("Blogs and Editorials")){
            return Category.OPINION_BLOG_EDITORIAL;
        } else if (categoryName.equalsIgnoreCase("Add New")){
            return Category.ADD_NEW;
        }else {
            return Category.valueOf(categoryName.toUpperCase());
        }
    }
}




Java Source Code List

in.sahildave.gazetti.StarterApplication.java
in.sahildave.gazetti.bookmarks.BookmarkAdapter.java
in.sahildave.gazetti.bookmarks.BookmarkDetailActivity.java
in.sahildave.gazetti.bookmarks.BookmarkDetailFragment.java
in.sahildave.gazetti.bookmarks.BookmarkListActivity.java
in.sahildave.gazetti.bookmarks.BookmarkListFragment.java
in.sahildave.gazetti.bookmarks.BookmarkLoadingCallback.java
in.sahildave.gazetti.bookmarks.sqlite.BookmarkDataSource.java
in.sahildave.gazetti.bookmarks.sqlite.BookmarkModel.java
in.sahildave.gazetti.bookmarks.sqlite.SQLiteHelper.java
in.sahildave.gazetti.homescreen.HomeScreenActivity.java
in.sahildave.gazetti.homescreen.HomeScreenFragment.java
in.sahildave.gazetti.homescreen.adapter.AddCellDialogFragment.java
in.sahildave.gazetti.homescreen.adapter.CellModel.java
in.sahildave.gazetti.homescreen.adapter.EditCellDialogFragment.java
in.sahildave.gazetti.homescreen.adapter.GridAdapter.java
in.sahildave.gazetti.homescreen.adapter.NewsCatModel.java
in.sahildave.gazetti.homescreen.newcontent.DialogNewContentExpListAdaper.java
in.sahildave.gazetti.homescreen.newcontent.DialogNewContent.java
in.sahildave.gazetti.news_activities.ArticleLoadingCallback.java
in.sahildave.gazetti.news_activities.WebViewFragment.java
in.sahildave.gazetti.news_activities.WebsiteDetailActivity.java
in.sahildave.gazetti.news_activities.WebsiteDetailFragment.java
in.sahildave.gazetti.news_activities.WebsiteListActivity.java
in.sahildave.gazetti.news_activities.WebsiteListFragment.java
in.sahildave.gazetti.news_activities.adapter.NavDrawerListAdapter.java
in.sahildave.gazetti.news_activities.adapter.NewsAdapter.java
in.sahildave.gazetti.news_activities.adapter.RobotoLight.java
in.sahildave.gazetti.news_activities.fetch.firstPost.java
in.sahildave.gazetti.news_activities.fetch.hindu.java
in.sahildave.gazetti.news_activities.fetch.indianExpressBusiness.java
in.sahildave.gazetti.news_activities.fetch.indianExpress.java
in.sahildave.gazetti.news_activities.fetch.toi.java
in.sahildave.gazetti.preference.FeedSelectFragment.java
in.sahildave.gazetti.preference.FeedSelectSettingsActivity.java
in.sahildave.gazetti.preference.LicensesActivity.java
in.sahildave.gazetti.preference.PreferenceExpListAdapter.java
in.sahildave.gazetti.preference.SettingsActivity.java
in.sahildave.gazetti.util.BitmapTransform.java
in.sahildave.gazetti.util.ConfigService.java
in.sahildave.gazetti.util.Constants.java
in.sahildave.gazetti.util.GazettiEnums.java
in.sahildave.gazetti.util.JsonHelper.java
in.sahildave.gazetti.util.NewsCatFileUtil.java
in.sahildave.gazetti.util.ShareButtonListener.java
in.sahildave.gazetti.util.UserPrefUtil.java
in.sahildave.gazetti.welcomescreen.WelcomeScreenExpListAdapter.java
in.sahildave.gazetti.welcomescreen.WelcomeScreenFragmentExpList.java
in.sahildave.gazetti.welcomescreen.WelcomeScreenFragmentFirst.java
in.sahildave.gazetti.welcomescreen.WelcomeScreenViewPagerActivity.java