package xn.hxp.ui.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import xn.hxp.R
import com.rc.httpcore.bean.StockDetailsModel


class LabelDialogAdapter :
    BaseQuickAdapter<StockDetailsModel, BaseViewHolder>(R.layout.label_dialog_rv) {
    private val str = "请扫描RFID标签"
    private var isOK: Boolean = false

    init {
        addChildClickViewIds(R.id.imgDelete)
    }

    override fun convert(holder: BaseViewHolder, item: StockDetailsModel) {
        holder.setText(R.id.no, "${item.no}")
        holder.setText(R.id.tagCode, "${item.tagCode}")
        val rfidCode = holder.getView<TextView>(R.id.rfidCode)
        rfidCode.hint = ""
        if (item.rfidCode != null) {
            rfidCode.text = "${item.rfidCode}"
        }else{
            rfidCode.text=""
        }
        if (holder.adapterPosition == 0 && data.size == 1) {
            rfidCode.hint = str
        } else {
            if (holder.adapterPosition == 0 && item.rfidCode == null) {
                rfidCode.hint = str
            } else {
                if (holder.adapterPosition > 0 && data[holder.adapterPosition - 1].rfidCode != null) {
                    rfidCode.hint = str
                }
            }
        }

    }


}