Android Open Source - Gazetti_Newspaper_Reader Bookmark Adapter






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.bookmarks;
//from   w  w w  .ja  v  a  2 s.c  om
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import in.sahildave.gazetti.R;
import in.sahildave.gazetti.bookmarks.sqlite.BookmarkModel;

import java.util.HashMap;
import java.util.List;

public class BookmarkAdapter extends ArrayAdapter<BookmarkModel> {

    private static final String LOG_TAG = BookmarkAdapter.class.getName();
    private static final int SECOND_MILLIS = 1000;
    private static final int MINUTE_MILLIS = 60 * SECOND_MILLIS;
    private static final int HOUR_MILLIS = 60 * MINUTE_MILLIS;
    private static final int DAY_MILLIS = 24 * HOUR_MILLIS;

    private Activity ctx;

    public static HashMap<String, String> linkMap = new HashMap<String, String>();
    public static HashMap<String, String> catNameMap = new HashMap<String, String>();
    public static HashMap<String, String> npNameMap = new HashMap<String, String>();
    public static HashMap<String, String> articleImage = new HashMap<String, String>();
    public static HashMap<String, String> articleBody = new HashMap<String, String>();
    public static HashMap<String, String> pubDateMap = new HashMap<String, String>();

    private List<BookmarkModel> articleObjectList;

    public BookmarkAdapter(Activity context, List<BookmarkModel> articleObjectList) {
        super(context, R.layout.headline_list_row, articleObjectList);
        ctx = context;
        this.articleObjectList = articleObjectList;
    }

    static class ViewHolder {
        TextView textViewItem;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            LayoutInflater inflater = ctx.getLayoutInflater();
            convertView = inflater.inflate(R.layout.headline_list_row, parent, false);

            holder = new ViewHolder();
            holder.textViewItem = (TextView) convertView.findViewById(R.id.headline);
            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        BookmarkModel object = articleObjectList.get(position);
        // Add the title view
        holder.textViewItem.setText(object.getmArticleHeadline());

        // Add title, link to a Map
        try {
            String articleHeadline = object.getmArticleHeadline();
            linkMap.put(articleHeadline, object.getmArticleURL());
            pubDateMap.put(articleHeadline, object.getmArticlePubDate());
            catNameMap.put(articleHeadline, object.getCategoryName());
            npNameMap.put(articleHeadline, object.getNewspaperName());
            articleImage.put(articleHeadline, object.getmArticleImageURL());
            articleBody.put(articleHeadline, object.getmArticleBody());
        } catch (Exception e) {
            Crashlytics.logException(e);
        }
        return convertView;

    }
}




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