package com.wd.workoffice.ui.adapter;


import android.net.Uri;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.mesBean.ImageBean;
import com.wd.workoffice.util.GlideUtils;

import java.util.List;

/**
 * Created by flexible on 2018/8/13.
 */

public class ImgAddAdapter extends BaseQuickAdapter<ImageBean, BaseViewHolder> {

    public ImgAddAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ImageBean item) {
        ImageView ivImg = helper.getView(R.id.iv_img);
        if (helper.getAdapterPosition() != getData().size() - 1) {
            helper.setGone(R.id.iv_delete, true);
            helper.addOnClickListener(R.id.iv_delete);
            GlideUtils.getRequest().load(item.getUri()).into(ivImg);
        } else {
            helper.setGone(R.id.iv_delete, false);
            GlideUtils.getRequest().load(R.mipmap.img_add).into(ivImg);
        }

    }
}

