Android Open Source - UniversalImagePick Bucket Adapter






From Project

Back to project page UniversalImagePick.

License

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.

Java Source Code

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




Java Source Code List

com.luffyjet.universalimagepick.App.java
com.luffyjet.universalimagepick.Constants.java
com.luffyjet.universalimagepick.MainActivity.java
com.luffyjet.universalimagepick.Test.java
com.luffyjet.universalimagepick.adapter.BucketAdapter.java
com.luffyjet.universalimagepick.adapter.GalleryAdapter.java
com.luffyjet.universalimagepick.adapter.PickGridAdapter.java
com.luffyjet.universalimagepick.adapter.PreviewAdapter.java
com.luffyjet.universalimagepick.adapter.ResultAdapter.java
com.luffyjet.universalimagepick.model.ImageBucket.java
com.luffyjet.universalimagepick.model.Image.java
com.luffyjet.universalimagepick.model.ImagesHelper.java
com.luffyjet.universalimagepick.model.Thumbnail.java
com.luffyjet.universalimagepick.ui.BaseActivity.java
com.luffyjet.universalimagepick.ui.GalleryActivity.java
com.luffyjet.universalimagepick.ui.PickActivity.java
com.luffyjet.universalimagepick.utils.LogUtil.java
com.luffyjet.universalimagepick.widget.CropImageView.java
com.luffyjet.universalimagepick.widget.CustomGridView.java
com.luffyjet.universalimagepick.widget.MulitPointTouchListener.java
com.luffyjet.universalimagepick.widget.ViewfinderView.java