关于相册九宫格选中未选中逻辑的判断
背景介绍:由于服务器获取下来的 PhotoBean 类 里面没有是否选中这一字段,故自己从业务逻辑出发,增加这一字段,set-get 方法。
点击时候:
photoAlbumAdapter.setOnItemClickListener(newBaseQuickAdapter.OnItemClickListener() {
@Override
public voidonItemClick(BaseQuickAdapter adapter, View view,intposition) {
booleanselected =photoDatas.get(position).getisSelected();
String photo_id =photoDatas.get(position).getPhoto_id();
View viewByPosition =gridViewManager.findViewByPosition(position);
ImageView imgSelected = (ImageView) viewByPosition.findViewById(R.id.recycle_mine_choice);
selectedLists.add(photo_id);
ArrayList selecteds =newArrayList();
if(position ==0) {
ToastUtils.StrToast(mContext,"打开系统相册");
openChooser();
}else if(Is_Delete) {
if(selected){
imgSelected.setVisibility(View.INVISIBLE);
photoDatas.get(position).setSelected(!selected);
}else{
imgSelected.setVisibility(View.VISIBLE);
photoDatas.get(position).setSelected(!selected);
}
}
}
});
public static classListDataBean {
/**
* photo_id : 11
* photo_pic :
* photo_pic_big :
*/
privateStringphoto_id;
privateStringphoto_pic;
privateStringphoto_pic_big;
private booleanisSelected;
public voidsetSelected(booleanselected) {
isSelected= selected;
}
public booleangetisSelected() {
returnisSelected;
}
publicString getPhoto_id() {
returnphoto_id;
}
public voidsetPhoto_id(String photo_id) {
this.photo_id= photo_id;
}
publicString getPhoto_pic() {
returnphoto_pic;
}
public voidsetPhoto_pic(String photo_pic) {
this.photo_pic= photo_pic;
}
publicString getPhoto_pic_big() {
returnphoto_pic_big;
}
public voidsetPhoto_pic_big(String photo_pic_big) {
this.photo_pic_big= photo_pic_big;
}
【关于相册九宫格选中未选中逻辑的判断】}
推荐阅读
- Android中关于定时任务实现关闭订单问题
- 2/30|2/30 钻石行动杭州线下
- 关于生活
- 关于List、Map、Stream初始化方式
- vue关于自定义指令与v-if冲突的问题
- 关于Kafka消息队列原理的总结
- 关于mybatis的 insert into select 命令未结束问题
- 关于Mac上部署Jenkins的一些个人习惯
- 关于我喜欢你这件事
- 杂谈