package com.lukouguoji.gjc.holder

import android.view.View
import com.lukouguoji.gjc.databinding.ItemBoxAddJBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.JianBean
import com.lukouguoji.module_base.ktx.loge

class BoxAddListJViewHolder(view: View) : BaseViewHolder<JianBean, ItemBoxAddJBinding>(view) {

    override fun onBind(item: Any?, position: Int) {
        val bean = getItemBean(item) ?: return

        binding.tv.text = bean.code
        binding.iv.visibility = if (bean.checked.get()) View.VISIBLE else View.GONE

        binding.rl.setOnClickListener {
            bean.checked.set(!bean.checked.get())
            binding.iv.visibility = if (bean.checked.get()) View.VISIBLE else View.GONE
        }
    }

}