package com.quansu.heifengwuliu.adapter

import android.view.View
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.quansu.heifengwuliu.R
import com.quansu.heifengwuliu.databinding.ItemCollectionBinding
import com.quansu.heifengwuliu.model.DriverBean
import com.ysnows.base.base.BAdapter

class CollectionAdapter(val type:String) : BAdapter<DriverBean, BaseDataBindingHolder<ItemCollectionBinding>>(R.layout.item_collection) {
    override fun convert(holder: BaseDataBindingHolder<ItemCollectionBinding>, item: DriverBean) {
        holder.dataBinding?.item = item
        if(type=="0"){
            holder.dataBinding?.imgCheck!!.visibility=View.GONE
        }
        holder.dataBinding?.imgCheck!!.setOnClickListener {
            if(item.checked==0) item.checked=1 else item.checked=0
            notifyItemChanged(holder.adapterPosition)
        }
    }
}
