package com.zxbw.modulemain.adapter

import android.app.Activity
import android.graphics.Paint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.qy.RightsDetailEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener

class RechargeAdapter : BaseRecyclerAdapter<RightsDetailEntity, RechargeAdapter.ViewHolder> {
    private var mContext: Activity? = null
    private val listener: OnRecycleItemClickListener<RightsDetailEntity>

    constructor(
        content: Activity?,
        listener: OnRecycleItemClickListener<RightsDetailEntity>
    ) : super() {
        mContext = content
        this.listener = listener
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
//        var bean = mList[position]
//        holder.id_tv_cards_name?.text = "${bean.brand}${bean.goodsName}${bean.category}"
//        holder.id_tv_cagte_name?.text = "${bean.category}"
//        //  holder.id_goods_icon?.setLoadImageUrl(bean.icon,false)
//        holder.id_goods_yuan_jia?.text = "${bean.goodsName}"
//        holder.id_tv_card_discount?.text = "会员专享${bean.costDiscount}折"
//        holder.id_tv_card_price?.text = "${bean.salePrice}"
//        holder.id_tv_guanfang_price?.text = "官方价 ¥${bean.originPrice}元"
//        holder.id_tv_guanfang_price?.getPaint()?.setFlags(Paint.STRIKE_THRU_TEXT_FLAG) //中划线
//        holder.id_ll_item?.setOnClickListener {
//            listener.onItemClick(it, position, bean)
//        }
    }

    override fun getItemCount(): Int {
        return 3
    }

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

    class ViewHolder : RecyclerView.ViewHolder {
        var id_ll_item: LinearLayout?

        // var id_goods_icon: RecycleImageView?
        var id_tv_activity_price_text: TextView?
        var id_tv_rmb: TextView?
        var id_tv_price: TextView?
        var id_tv_orgin_price: TextView?



        constructor(
            itemView: View
        ) : super(itemView) {
            id_ll_item =
                itemView.findViewById<LinearLayout>(R.id.id_ll_item)
            id_tv_activity_price_text = itemView.findViewById<TextView>(R.id.id_tv_activity_price_text)
            id_tv_rmb = itemView.findViewById<TextView>(R.id.id_tv_rmb)
            id_tv_price = itemView.findViewById<TextView>(R.id.id_tv_price)
            id_tv_orgin_price = itemView.findViewById<TextView>(R.id.id_tv_orgin_price)
        }
    }
}