package com.zj365.health.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.luck.picture.lib.entity.LocalMedia
import com.xty.base.adapter.BaseAdapter
import com.xty.common.getImageUrl
import com.xty.common.setImage
import com.zj365.health.R

class ImageAdapter(var isShow:Boolean=false):BaseAdapter<Any>(R.layout.item_image) {
    override fun convert(holder: BaseViewHolder, item: Any) {
        if(item is LocalMedia){
            holder.getView<ImageView>(R.id.mImage).setImage(context,item.compressPath)
        }else if(item is String){
            holder.getView<ImageView>(R.id.mImage).apply {
                setImage(context,getImageUrl(item))
            }
            holder.setGone(R.id.mClose,isShow)
        }
    }

}