lmw
2024-06-18 1f45a54dc8e149548d3a61d1228741627aa4f23e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.dollearn.student.ui.welfare.adapter
 
import android.widget.TextView
import cn.sinata.xldutils.adapter.HFRecyclerAdapter
import cn.sinata.xldutils.adapter.util.ViewHolder
import com.dollearn.student.R
import org.jetbrains.anko.backgroundResource
import java.util.ArrayList
 
class ShopCheckAdapter(list: ArrayList<String>):HFRecyclerAdapter<String>(list, R.layout.item_shop_check) {
    var checked = 0
    override fun onBind(holder: ViewHolder, position: Int, data: String) {
        holder.bind<TextView>(R.id.tv_name).apply {
            text = data
            if (position == checked){
                backgroundResource = R.drawable.bg_orange_line_4dp
                setCompoundDrawablesRelativeWithIntrinsicBounds(0,0,R.mipmap.icon_selected,0)
            }else{
                backgroundResource = R.drawable.bg_grey_line_4dp
                setCompoundDrawablesRelativeWithIntrinsicBounds(0,0,R.mipmap.icon_radiobutton,0)
            }
        }
    }
 
}