package com.ym.game.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.ym.ddhy.R
import com.ym.modulecommon.AppliContext
import com.ym.library.base.BaseRecyclerAdapter
import com.ym.library.module.WdHistoryEntity

class RecordAdapter : BaseRecyclerAdapter<WdHistoryEntity, RecordAdapter.ViewHolder> {
    private var mContext: Context? = null

    constructor(
        content: Context?
    ) : super() {
        mContext = content
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        var bean = mList[position]
        holder.item_title?.text = bean.title
        holder.item_time?.text = bean.time
        holder.item_cash?.text = bean.wdAmount
        holder.item_result?.text = bean.result

    }


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        return ViewHolder(
            LayoutInflater.from(AppliContext.get())
                .inflate(R.layout.item_layout_record, parent, false)
        )
    }

    class ViewHolder : RecyclerView.ViewHolder {
        var item_title: TextView?
        var item_time: TextView?
        var item_cash: TextView?
        var item_result: TextView?

        constructor(
            itemView: View
        ) : super(itemView) {
            item_title = itemView.findViewById<TextView>(R.id.id_record_title)
            item_time = itemView.findViewById<TextView>(R.id.id_record_time)
            item_cash = itemView.findViewById<TextView>(R.id.id_record_cash)
            item_result = itemView.findViewById<TextView>(R.id.id_record_result)
        }
    }

}