package com.sambath.kunkhmer.screen.result

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.gdtlib.lib.adapter.BaseListItem
import com.gdtlib.lib.viewholder.BaseListViewHolder
import com.sambath.kunkhmer.R

class Table1ListViewHolder(
    itemView: View
) : BaseListViewHolder(itemView) {
    private val ivCircle = itemView.findViewById<ImageView>(R.id.img_color)
    private val txtFightNo = itemView.findViewById<TextView>(R.id.txtFightNo)
    override fun bindView(item: BaseListItem) {
        when (item) {
            is Table1ListItem -> {
                with(item) {
                    txtFightNo.text = fightNo
                    when (color) {
                        "cir-blue" -> {//1 is blue small
                            ivCircle.setImageResource(R.drawable.bg_circle_blue)
                        }
                        "cir-red" -> {//2 is red big
                            ivCircle.setImageResource(R.drawable.bg_circle_red)
                        }
                        "cir-green" -> {//3 is green big
                            ivCircle.setImageResource(R.drawable.bg_circle_green)
                        }
                        "cir-cancel" -> {//4 is yellow big
                            ivCircle.setImageResource(R.drawable.bg_circle_yellow)
                        }
                    }
                }
            }
        }
    }
}