package com.zxbw.modulemain.adapter

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Paint
import android.text.TextUtils
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.LinearLayoutManager
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.box.DepotEntity
import com.zxhl.cms.net.model.box.ShopOrderEntity
import com.zxhl.cms.net.model.shop.ShopListEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.utils.Utils
import com.zxhl.cms.widget.RecycleImageView

//搜索商品排行榜
class SearchGoodsTopAdapter :
    BaseRecyclerAdapter<ShopListEntity, SearchGoodsTopAdapter.ViewHolder> {
    private var mContext: Context? = null
    private val listener: OnRecycleItemClickListener<ShopListEntity>

//    private var mTopIconList = listOf(
////        R.drawable.icon_goods_top1,
////        R.drawable.icon_goods_top2,
////        R.drawable.icon_goods_top3,
////        R.drawable.icon_goods_top4,
////        R.drawable.icon_goods_top5,
////        R.drawable.icon_goods_top6,
////        R.drawable.icon_goods_top7,
////        R.drawable.icon_goods_top8,
////        R.drawable.icon_goods_top9
//    )

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

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        var bean = mList[position]
//        holder.id_rl_goods_item?.setOnClickListener {
//            listener?.onItemClick(it, position, bean)
//        }
//        holder.id_tv_goods_name?.text = bean.productName
////        holder.id_tv_goods_price?.text = bean.salePriceStr
//        holder.id_tv_goods_price?.text = bean.originalPriceDb
//        holder.id_img_goods_img?.setLoadImageUrl(bean.mainImage, false)
//        holder.id_tv_goods_sale_num?.text = "${bean.salesVolume ?: "0"}人付款"
////        holder.id_tv_goods_old_price?.text = "¥${bean.originalPriceDb}"
//        holder.id_tv_goods_old_price?.text = "¥${bean.salePriceStr}"
//        holder.id_tv_goods_old_price?.paint?.flags = Paint.STRIKE_THRU_TEXT_FLAG
        if (position < 9) {
//            holder.id_img_goods_number?.setImageResource(mTopIconList[position])
        }

    }

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

    class ViewHolder : RecyclerView.ViewHolder {
//        var id_rl_goods_item: RelativeLayout?
//        var id_img_goods_img: RecycleImageView?
//        var id_tv_goods_name: TextView?
//        var id_tv_goods_price: TextView?
//        var id_tv_goods_old_price: TextView?
//        var id_tv_goods_sale_num: TextView?
//        var id_img_goods_number: ImageView?

        constructor(
            itemView: View
        ) : super(itemView) {
//            id_rl_goods_item = itemView.findViewById<RelativeLayout>(R.id.id_rl_goods_item)
//            id_img_goods_img = itemView.findViewById<RecycleImageView>(R.id.id_img_goods_img)
//            id_tv_goods_name = itemView.findViewById<TextView>(R.id.id_tv_goods_name)
//            id_tv_goods_price = itemView.findViewById<TextView>(R.id.id_tv_goods_price)
//            id_tv_goods_old_price = itemView.findViewById<TextView>(R.id.id_tv_goods_old_price)
//            id_tv_goods_sale_num = itemView.findViewById<TextView>(R.id.id_tv_goods_sale_num)
//            id_img_goods_number = itemView.findViewById<ImageView>(R.id.id_img_goods_number)
        }
    }

}