package com.zxhl.main.page.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.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.box.DepotEntity
import com.zxhl.cms.net.model.box.LotteryEntity
import com.zxhl.cms.widget.RecycleImageView
import com.zxhl.main.R

class RecoverDetailAdapter : BaseRecyclerAdapter<LotteryEntity, RecoverDetailAdapter.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_img_goods?.setLoadImageUrl(bean.mainImage,false)
        holder?.item_tv_good_name?.text=bean.productName
        holder?.item_tv_good_price?.text=bean.amountSpent
        holder?.item_recover_price?.text=bean.recoverPriceStr


    }


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

    class ViewHolder : RecyclerView.ViewHolder {

        var item_img_goods: RecycleImageView?
        var item_tv_good_name: TextView?
        var item_tv_good_price: TextView?
        var item_recover_price: TextView?

        constructor(
            itemView: View
        ) : super(itemView) {

            item_tv_good_name = itemView.findViewById<TextView>(R.id.id_goods_name)
            item_tv_good_price = itemView.findViewById<TextView>(R.id.id_tv_good_price)
            item_img_goods = itemView.findViewById<RecycleImageView>(R.id.id_goods_img)
            item_recover_price = itemView.findViewById<TextView>(R.id.id_tv_recover_price)
        }
    }
}