package com.unis.sxzcl.base.base_detail;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.unis.sxzcl.R;

import org.jetbrains.annotations.NotNull;

/**
 * 包名: com.unis.sxzcl.base.base_detail
 * 类名: ImageItemProvider
 * 作用描述:
 * 创建人: mQ
 * 创建时间: 2020/12/2 15:45
 * 更新人:
 * 更新时间: 2020/12/2 15:45
 * 更新说明:
 * 版本号: 1.0
 */
public class ImageItemProvider extends BaseItemProvider<BaseDetailBean> {

    @Override
    public int getItemViewType() {
        return BaseDetail.TITLE_IMAGE;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_base_image;
    }

    @Override
    public void convert(@NotNull BaseViewHolder holder, BaseDetailBean item) {
        holder.setText(R.id.tv_title, item.getTitle());
        Glide.with(getContext())
                .load(R.drawable.no_banner)
                .placeholder(R.drawable.ic_img_loading)
                .error(R.drawable.no_banner)
                .into((ImageView) holder.getView(R.id.iv_show));

        holder.setGone(R.id.iv_next, !item.isNextIcon());
        holder.setGone(R.id.iv_down, !item.isDownIcon());
    }
}