package com.zj365.health.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setRoundImage
import com.zj365.health.R


class PictureAdapter : BaseAdapter<String>(R.layout.item_picture) {
    override fun convert(holder: BaseViewHolder, item: String) {
        if (item.isEmpty()){
            holder.itemView.findViewById<ImageView>(R.id.ivImage).setImageResource(R.mipmap.changctup)
            holder.setGone(R.id.ivDelete,true)
            holder.setGone(R.id.tvNumb,true)
        } else {
            holder.setGone(R.id.ivDelete,false)
            holder.setGone(R.id.tvNumb,false)
            holder.setText(R.id.tvNumb,(holder.adapterPosition+1).toString())
            holder.getView<ImageView>(R.id.ivImage)
                .apply {
                    setRoundImage(context, item)
                }
        }
    }
}