Android Open Source - Gazetti_Newspaper_Reader Grid 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.homescreen.adapter;
/ * w w w . j a v a 2 s . c o m * /
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import in.sahildave.gazetti.R;
import java.util.List;
public class GridAdapter extends BaseAdapter {
// private String TAG = "HomeScreen";
private Context mContext;
private int cell_dimen;
private LayoutInflater mInflater;
List<CellModel> cellList;
public GridAdapter(Context c, List<CellModel> cellList) {
mContext = c;
this.cell_dimen = (int ) c.getResources().getDimension(R.dimen.cell_dimen);
mInflater = LayoutInflater.from(c);
this.cellList = cellList;
}
public int getCount() {
return cellList.size();
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
static class ViewHolder {
ImageView cellItemImage;
TextView cellItemTitle;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.homescreen_cell_layout, parent, false);
holder = new ViewHolder();
holder.cellItemImage = (ImageView) convertView.findViewById(R.id.cellItemImageView);
holder.cellItemTitle = (TextView) convertView.findViewById(R.id.cellItemTitle);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
CellModel modelObject = cellList.get(position);
String uri = modelObject.getNewspaperImage();
int resID = mContext.getResources().getIdentifier(uri, "drawable" , mContext.getPackageName());
holder.cellItemImage.setLayoutParams(new RelativeLayout.LayoutParams(cell_dimen, cell_dimen));
holder.cellItemImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
holder.cellItemImage.setPadding(8, 8, 8, 8);
holder.cellItemImage.setImageResource(resID);
holder.cellItemTitle.setText(modelObject.getCategoryTitle());
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