package com.swago.room.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.swago.baseswago.model.live.game.GameModel
import com.swago.room.R

/**
 *@date 2022/2/8 11:42
 *description:
 */
class GameAdapter : BaseQuickAdapter<GameModel,BaseViewHolder>(R.layout.item_game, arrayListOf()) {

    override fun convert(helper: BaseViewHolder, item: GameModel) {
        helper.apply {
            val ivIcon = itemView.findViewById<ImageView>(R.id.ivIcon)
            Glide.with(itemView.context).load(item.game_icon_url).placeholder(R.mipmap.default_avatar).error(R.mipmap.default_avatar).into(ivIcon)
            if (item.selected){
                setBackgroundRes(R.id.fl,R.drawable.shape_9ffd88_5_stroke)
            }else{
                setBackgroundRes(R.id.fl,R.drawable.shape_tranparent)
            }
        }
    }


}