package com.zxbw.modulemain.adapter

import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
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.utils.OnRecycleItemClickListener


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

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

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {


        holder.id_ll_red_envelop_view?.setOnClickListener {
            listener.onItemClick(it, position, null)
        }


    }

    override fun getItemCount(): Int {
        return 24
    }

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

    class ViewHolder : RecyclerView.ViewHolder {
        var id_ll_red_envelop_view: LinearLayout?
        var id_tv_time: TextView?
        var id_img_red_envelope_bg: ImageView?

        constructor(
            itemView: View
        ) : super(itemView) {
            id_ll_red_envelop_view = itemView.findViewById<LinearLayout>(R.id.id_ll_red_envelop_view)
            id_tv_time = itemView.findViewById<TextView>(R.id.id_tv_time)
            id_img_red_envelope_bg = itemView.findViewById<ImageView>(R.id.id_img_red_envelope_bg)
        }
    }

}