package com.lukouguoji.gjj.holder

import android.view.View
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ItemGjjTallyBinding
import com.lukouguoji.gjj.databinding.ItemTallyDetailsBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.bean.GjjTallyDetailsBean
import com.lukouguoji.module_base.impl.ListChangedCallBackImpl
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.refresh

class GjjTallyDetailsViewHolder(view: View) :
    BaseViewHolder<GjjTallyDetailsBean, ItemTallyDetailsBinding>(view) {

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

        binding.rv.adapter = CommonAdapter(
            itemView.context,
            R.layout.item_jian,
            JianViewHolder::class.java
        )

        binding.rv.refresh(bean.jianList)

        bean.jianList.addOnListChangedCallback(ListChangedCallBackImpl() {
            binding.rv.refresh(bean.jianList)
        })

    }

}