package com.zxhl.cms.pay.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.zxhl.cms.R
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.chat.RecordEntity

/**
 * @author (wangXuewei)
 * @datetime 2022-04-12 19:04 GMT+8
 * @detail :
 */
class BecomeVipDialogBannerAdapter :
    BaseRecyclerAdapter<Any, BecomeVipDialogBannerAdapter.ViewHolder> {
    private var mContext: Context? = null
    private var bannerBgImg = listOf(
        R.drawable.vip_banner_long1,
        R.drawable.vip_banner_long1,
        R.drawable.vip_banner_long2,
        R.drawable.vip_banner_long3,
        R.drawable.vip_banner_long4,
    )
    private var bannerIconImg = listOf(
        R.drawable.icon_banner_video,
        R.drawable.icon_banner_video,
        R.drawable.icon_banner_vip,
        R.drawable.icon_banner_view,
        R.drawable.icon_banner_chat,
    )
    private var bannerDesc = listOf(
        "Buy a package below to chat with\n a beautiful Girl",
        "Video chat with friends",
        "Exclusive VIP flag",
        "View the album for free",
        "Free text chat"
    )

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

    override fun onCreateViewHolder(
        holder: ViewGroup,
        p1: Int
    ): BecomeVipDialogBannerAdapter.ViewHolder {
        return ViewHolder(
            LayoutInflater.from(holder.context)
                .inflate(R.layout.item_layout_become_vip_dialog_banner_view, holder, false)
        )
    }

    override fun onBindViewHolder(holder: BecomeVipDialogBannerAdapter.ViewHolder, position: Int) {
        holder.banner_bg.setBackgroundResource(bannerBgImg[position])
        holder.desc.text = bannerDesc[position]
        holder.view_type2.setImageResource(bannerIconImg[position])
        if (position == 0) {
            holder.view_type1.visibility = View.VISIBLE
            holder.view_type2.visibility = View.INVISIBLE
        } else {
            holder.view_type1.visibility = View.INVISIBLE
            holder.view_type2.visibility = View.VISIBLE
        }
    }

    override fun getItemCount(): Int {
        return bannerBgImg.size
    }

    inner class ViewHolder : RecyclerView.ViewHolder {


        var banner_bg: RelativeLayout
        var view_type1: RelativeLayout
        var view_type2: ImageView
        var desc: TextView

        constructor(itemView: View) : super(itemView) {
            banner_bg = itemView.findViewById(R.id.id_rl_item_view)
            view_type1 = itemView.findViewById(R.id.id_rl_pay_introduce_type1)
            view_type2 = itemView.findViewById(R.id.id_img_pay_introduce_type2)
            desc = itemView.findViewById(R.id.id_tv_desc)
        }
    }

}