lmw
2025-04-24 718f31c92e2029d05260810435a2c70cef6e6ce5
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
26
27
28
29
30
31
32
package com.sinata.xqmuse.ui.mine.adapter
 
import android.view.View
import android.widget.TextView
import cn.sinata.xldutils.adapter.HFRecyclerAdapter
import cn.sinata.xldutils.adapter.util.ViewHolder
import com.sinata.xqmuse.R
import com.sinata.xqmuse.network.entity.RechargeItem
import org.jetbrains.anko.backgroundResource
import org.jetbrains.anko.textColorResource
import java.util.ArrayList
 
class RechargeAdapter(datas: ArrayList<RechargeItem>):HFRecyclerAdapter<RechargeItem>(datas, R.layout.item_recharge){
    var checked = 0
    override fun onBind(holder: ViewHolder, position: Int, data: RechargeItem) {
        holder.setText(R.id.tv_coin,"${data.wpGold.toInt()}币")
        holder.setText(R.id.tv_price,"¥${data.amount}")
        val bg = holder.bind<View>(R.id.ll_bg)
        val tv_coin = holder.bind<TextView>(R.id.tv_coin)
        val tv_price = holder.bind<TextView>(R.id.tv_price)
        if (position == checked){
            bg.backgroundResource = R.drawable.bg_recharge_checked
            tv_coin.textColorResource = R.color.colorPrimary
            tv_price.textColorResource = R.color.colorPrimary
        }else{
            bg.backgroundResource =  R.drawable.bg_recharge_uncheck
            tv_coin.textColorResource = R.color.textColor66
            tv_price.textColorResource = R.color.textColor66
        }
    }
 
}