package xn.hxp.ui.adapter

import android.content.Context
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import xn.hxp.R
import com.rc.httpcore.bean.MsdsListBean


class MsdsListAdapter(private val ct: Context) :
    BaseQuickAdapter<MsdsListBean, BaseViewHolder>(R.layout.item_msds_list) {

    override fun convert(holder: BaseViewHolder, item: MsdsListBean) {
        holder.setText(R.id.name, "${item.name}")
        if (item.isType) {
            holder.setTextColor(R.id.name, ContextCompat.getColor(ct, R.color.white))
            holder.setBackgroundResource(R.id.name, R.drawable.bg_sou_suo_tow)
        } else {
            holder.setTextColor(R.id.name, ContextCompat.getColor(ct, R.color.black))
            holder.setBackgroundResource(R.id.name, R.drawable.bg_sou_suo_tow_tou)
        }
    }
}