package com.base.appzxhy.ui.adapter

import android.annotation.SuppressLint
import android.content.Context
import android.view.ViewGroup
import com.base.appzxhy.R
import com.base.appzxhy.bean.CheckInBean
import com.base.appzxhy.databinding.ItemDayBalanceBinding
import com.base.appzxhy.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter

class CheckInAdapter : BaseQuickAdapter<CheckInBean, CommonViewHolder>() {

    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(holder: CommonViewHolder, position: Int, item: CheckInBean?) {
        item ?: return
        val binding = ItemDayBalanceBinding.bind(holder.itemView)
        if (item.checked) {
            binding.iv.setImageResource(R.mipmap.r_wancheng)
        } else {
            binding.iv.setImageResource(R.mipmap.r_day)
        }
        binding.tvDay.text = item.dayDesc
        binding.tvBalance.text = "+${item.balance}"
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): CommonViewHolder {
        return CommonViewHolder(R.layout.item_day_balance.inflate(parent))
    }


}