Android Open Source - SimpleReader Group Grid Adapter From Project Back to project page SimpleReader .
License The source code is released under:
Apache License
If you think the Android project SimpleReader 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 com.dreamteam.app.wallpaper;
/ * f r o m w w w . j a v a 2 s . c o m * /
import java.util.List;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import com.dreamteam.app.wallpaper.MyImageView.OnMeasureListener;
import com.dreamteam.app.wallpaper.NativeImageLoader.OnImageLoadListener;
import com.dreateam.app.ui.R;
public class GroupGridAdapter extends BaseAdapter {
private List<ImageBean> list;
private Context context;
private GridView gridView;
private Point mPoint = new Point(0, 0);
public GroupGridAdapter(Context context, List<ImageBean> list, GridView gridView) {
this.context = context;
this.list = list;
this.gridView = gridView;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ImageBean iBean = list.get(position);
ViewHolder holder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.grid_group_item, null);
holder = new ViewHolder();
holder.cover = (MyImageView) convertView.findViewById(R.id.group_image);
holder.title = (TextView) convertView.findViewById(R.id.group_title);
holder.count = (TextView) convertView.findViewById(R.id.group_count);
holder.cover.setOnMeasureListener(new OnMeasureListener() {
@Override
public void onMeasureSize(int width, int height) {
mPoint.set(width, height);
}
});
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
holder.cover.setImageResource(R.drawable.friends_sends_pictures_no);
}
holder.title.setText(iBean.getFolderName());
holder.count.setText(Integer.toString(iBean.getImageCounts()));
holder.cover.setTag(iBean.getTopImagePath());
Bitmap bitmap = NativeImageLoader.getInstance().loadImage(iBean.getTopImagePath(), mPoint,
new OnImageLoadListener() {
@Override
public void onImageLoad(String path, Bitmap bitmap) {
ImageView imageView = (ImageView) gridView.findViewWithTag(iBean.getTopImagePath());
if (bitmap != null && imageView != null){
imageView.setImageBitmap(bitmap);
}
}});
if (bitmap != null) {
holder.cover.setImageBitmap(bitmap);
}
return convertView;
}
private class ViewHolder {
private TextView count;
private TextView title;
private MyImageView cover;
}
}
Java Source Code List com.dreamteam.app.adapter.CategoryDetailAdapter.java com.dreamteam.app.adapter.FeedCategoryAdapter.java com.dreamteam.app.adapter.GridAdapter.java com.dreamteam.app.adapter.GuideViewPagerAdapter.java com.dreamteam.app.adapter.ItemListAdapter.java com.dreamteam.app.adapter.MPagerAdapter.java com.dreamteam.app.commons.AppConfig.java com.dreamteam.app.commons.AppContext.java com.dreamteam.app.commons.HtmlFilter.java com.dreamteam.app.commons.IFlyHelper.java com.dreamteam.app.commons.ItemListEntityParser.java com.dreamteam.app.commons.SectionHelper.java com.dreamteam.app.commons.SeriaHelper.java com.dreamteam.app.commons.SkinManager.java com.dreamteam.app.commons.UIHelper.java com.dreamteam.app.config.Contants.java com.dreamteam.app.db.DbManager.java com.dreamteam.app.db.FavoItemDbHelper.java com.dreamteam.app.db.FeedDBManager.java com.dreamteam.app.db.provider.RSSFeedCategoryProvider.java com.dreamteam.app.entity.FeedItem.java com.dreamteam.app.entity.Feed.java com.dreamteam.app.entity.ItemListEntity.java com.dreamteam.app.entity.RSSFeedCategroy.java com.dreamteam.app.entity.Section.java com.dreamteam.app.img.FileCacheManager.java com.dreamteam.app.img.FileCache.java com.dreamteam.app.img.ICache.java com.dreamteam.app.img.ImageLoadTask.java com.dreamteam.app.img.ImageLoad.java com.dreamteam.app.img.ImageLoader.java com.dreamteam.app.img.MemoryCache.java com.dreamteam.app.rss.Dates.java com.dreamteam.app.rss.Integers.java com.dreamteam.app.rss.MediaAttributes.java com.dreamteam.app.rss.MediaEnclosure.java com.dreamteam.app.rss.MediaThumbnail.java com.dreamteam.app.rss.RSSBase.java com.dreamteam.app.rss.RSSConfig.java com.dreamteam.app.rss.RSSException.java com.dreamteam.app.rss.RSSFault.java com.dreamteam.app.rss.RSSFeed.java com.dreamteam.app.rss.RSSHandler.java com.dreamteam.app.rss.RSSItem.java com.dreamteam.app.rss.RSSLoader.java com.dreamteam.app.rss.RSSParserSPI.java com.dreamteam.app.rss.RSSParser.java com.dreamteam.app.rss.RSSReaderException.java com.dreamteam.app.rss.RSSReader.java com.dreamteam.app.rss.Resources.java com.dreamteam.app.ui.About.java com.dreamteam.app.ui.BaseActivity.java com.dreamteam.app.ui.BaseTitledActivity.java com.dreamteam.app.ui.CategoryDetailActivity.java com.dreamteam.app.ui.ColorListActivity.java com.dreamteam.app.ui.FavoriteItemList.java com.dreamteam.app.ui.FeedCategoryActivity.java com.dreamteam.app.ui.FeedbackUI.java com.dreamteam.app.ui.GuideActivity.java com.dreamteam.app.ui.ImageDialog.java com.dreamteam.app.ui.ImagesBrowseActivity.java com.dreamteam.app.ui.ItemDetailActivity.java com.dreamteam.app.ui.ItemListActivity.java com.dreamteam.app.ui.LocalImageBrowseActivity.java com.dreamteam.app.ui.LoginDialog.java com.dreamteam.app.ui.MainActivity.java com.dreamteam.app.ui.Setting.java com.dreamteam.app.ui.SplashActivity.java com.dreamteam.app.ui.SwitchBgActivity.java com.dreamteam.app.ui.WidgetProvider.java com.dreamteam.app.ui.adapter.ColorListAdapter.java com.dreamteam.app.utils.CategoryNameExchange.java com.dreamteam.app.utils.DateUtils.java com.dreamteam.app.utils.FileUtils.java com.dreamteam.app.utils.HttpUtils.java com.dreamteam.app.utils.ImageLoader.java com.dreamteam.app.utils.ImageUtils.java com.dreamteam.app.utils.Logger.java com.dreamteam.app.utils.MD5.java com.dreamteam.app.utils.StringUtils.java com.dreamteam.app.wallpaper.ChildAdapter.java com.dreamteam.app.wallpaper.GroupGridAdapter.java com.dreamteam.app.wallpaper.ImageBean.java com.dreamteam.app.wallpaper.MyImageView.java com.dreamteam.app.wallpaper.NativeImageLoader.java com.dreamteam.app.wallpaper.WallPaperManager.java com.dreamteam.custom.ui.PathAnimations.java com.dreamteam.custom.ui.PullToRefreshListView.java