package com.khmer9.yuki.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.khmer9.yuki.R

class Table2ListViewHolder(
    itemView: View
) : BaseListViewHolder(itemView) {
    private val ivCircle = itemView.findViewById<ImageView>(R.id.img_color)
    private val tvNumber = itemView.findViewById<TextView>(R.id.tv_number)
    override fun bindView(item: BaseListItem) {
        when (item) {
            is Table2ListItem -> {
                with(item) {
                    when (rangeNumber) {
                        1 -> {//1 is blue
                            ivCircle.setImageResource(R.drawable.bg_circle_blue)
                            tvNumber.text = rangeNumber.toString()
                        }
                        4 -> {//2 is red
                            ivCircle.setImageResource(R.drawable.bg_circle_red)
                            tvNumber.text = rangeNumber.toString()
                        }
                        7 -> {//3 is blue
                            ivCircle.setImageResource(R.drawable.bg_circle_blue)
                            tvNumber.text = rangeNumber.toString()
                        }
                        10 -> {//4 is red
                            ivCircle.setImageResource(R.drawable.bg_circle_red)
                            tvNumber.text = rangeNumber.toString()
                        }
                    }
                }
            }
        }
    }
}