Back to project page UniversalImagePick.
The source code is released under:
Apache License
If you think the Android project UniversalImagePick listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.luffyjet.universalimagepick.adapter; /*from ww w. ja v a 2 s . co m*/ import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import com.luffyjet.universalimagepick.App.ImgLoaderOpts; import com.luffyjet.universalimagepick.R; import com.luffyjet.universalimagepick.model.ImageBucket; import com.nostra13.universalimageloader.core.ImageLoader; public class BucketAdapter extends BaseAdapter { private ArrayList<ImageBucket> mList; private Context mContext; private int selectedPos; public BucketAdapter(ArrayList<ImageBucket> mList, Context mContext) { super(); this.mList = mList; this.mContext = mContext; } @Override public int getCount() { return mList.size(); } @Override public ImageBucket getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vHolder = null; ImageBucket bucket = getItem(position); if (null==convertView) { vHolder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.image_bucket_item, null); vHolder.imageView = (ImageView) convertView.findViewById(R.id.icon); vHolder.titleTv = (TextView) convertView.findViewById(R.id.bucket_title); vHolder.checkBox = (ImageView) convertView.findViewById(R.id.check_btn); convertView.setTag(vHolder); }else { vHolder = (ViewHolder) convertView.getTag(); } if (position == selectedPos) { // vHolder.checkBox.setChecked(true); } vHolder.titleTv.setText(bucket.bucketName); ImageLoader.getInstance().displayImage("file://"+bucket.imageList.get(0).path,vHolder.imageView,ImgLoaderOpts.forImgSelect); return convertView; } static class ViewHolder{ public ImageView imageView; public TextView titleTv; public ImageView checkBox; } }