package com.cheng.blzb.ui.fragment.guide.adapter

import android.widget.TextView
import androidx.core.graphics.toColorInt
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.blzb.R
import com.cheng.blzb.bean.HotWordEntity
import com.example.base.extensions.getColor

class GuideItem4SelectedAdapter: BaseQuickAdapter<HotWordEntity.Child, BaseViewHolder>(R.layout.listitem_guide4_selected_keyword) {

    init {
        addChildClickViewIds(R.id.iv_delete)
    }

    override fun convert(holder: BaseViewHolder, item: HotWordEntity.Child) {
        holder.setText(R.id.tv_name, item.name)
        if (item.id == -1) {
            holder.setTextColor(R.id.tv_name, "#8D93A1".toColorInt())
            holder.setImageResource(R.id.iv_delete, R.mipmap.ic_guide_item4_default)
        } else {
            holder.setTextColor(R.id.tv_name, getColor(R.color.color_125ffe))
            holder.setImageResource(R.id.iv_delete, R.mipmap.ic_guide_item4_delete)
        }
        holder.getView<TextView>(R.id.tv_name).requestFocus()
    }
}