package com.tejia.lijin.app.ui.mine;
|
|
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.CompoundButton;
|
import android.widget.ImageView;
|
|
import com.bumptech.glide.Glide;
|
import com.tejia.lijin.app.R;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* Created by weikou2015 on 2018/9/27.
|
*/
|
|
public class ShareImageAdapter extends BaseAdapter {
|
|
private List<String> mList;
|
public List<String> selects = new ArrayList<>();
|
private Context mContext;
|
|
public ShareImageAdapter(Context context, List<String> list) {
|
this.mContext = context;
|
this.mList = list;
|
}
|
|
@Override
|
public int getCount() {
|
return mList == null ? 0 : mList.size();
|
}
|
|
@Override
|
public Object getItem(int i) {
|
return mList.get(i);
|
}
|
|
@Override
|
public long getItemId(int i) {
|
return i;
|
}
|
|
@Override
|
public View getView(final int position, View view, ViewGroup viewGroup) {
|
view = LayoutInflater.from(mContext).inflate(R.layout.item_image_share, null);
|
ImageView iv = view.findViewById(R.id.iv_gooods_more);
|
CheckBox cb_edit = view.findViewById(R.id.cb_edit);
|
|
Glide.with(mContext).load(mList.get(position)).placeholder(R.drawable.ic_goods_default)
|
.error(R.drawable.ic_goods_default).into(iv);
|
cb_edit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
@Override
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
if (isChecked) {
|
if (!selects.contains(mList.get(position)))
|
selects.add(mList.get(position));
|
// mCBFlag.put(position, true);
|
} else {
|
if (selects.contains(mList.get(position)))
|
selects.remove(mList.get(position));
|
// mCBFlag.put(position, false);
|
}
|
}
|
});
|
return view;
|
}
|
|
}
|