package com.abbidot.tracker.deprecated.adapter

import android.content.Context
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.list.RecyclerViewHolder
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.RechargeHistoryBean

/**
 *Created  by .yzq on 2022/1/29/029.
 * @link
 * @description:充值记录适配器
 */
class RechargeHistoryCNAdapter(ctx: Context, list: MutableList<RechargeHistoryBean>?) :
    BaseRecyclerAdapter<RechargeHistoryBean>(ctx, list) {

    override fun getEmptyLayoutId(viewType: Int) = 0

    override fun getItemLayoutId(viewType: Int) = R.layout.item_recharge_history_cn

    override fun bindData(holder: RecyclerViewHolder?, position: Int, item: RechargeHistoryBean) {
        holder!!.setText(R.id.recharge_history_cn_pay_time, item.payTime)
        val totalString = String.format(mContext.getString(R.string.txt_total_money),
                "+${mContext.getString(R.string.txt_month_until)}${item.cost}")
        holder.setText(R.id.recharge_history_cn_pay_money, totalString)
        holder.setText(R.id.recharge_history_cn_meal_name, item.feePackage)
        val deviceName = String.format(mContext.getString(R.string.txt_tracker_name),
                item.deviceOutId)
        holder.setText(R.id.recharge_history_cn_device_name, deviceName)
    }
}