package com.gh.gamecenter.home.test_v2

import android.content.Context
import android.view.ViewGroup
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.entity.RecommendLabel
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.lightgame.adapter.BaseRecyclerAdapter

/**
 * @author : liujiarui
 * date : 2023/3/6
 * description : 新游开测，推荐标签
 */
class HomeGameTestV2RecommendRvAdapter(
    context: Context,
    var data: List<RecommendLabel>,
    private val mLocation: String,
    private val mBlockData: SubjectRecommendEntity? = null
) : BaseRecyclerAdapter<HomeGameTestV2RecommendViewHolder>(context) {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeGameTestV2RecommendViewHolder {
        return HomeGameTestV2RecommendViewHolder(parent.toBinding(), mLocation, mBlockData)
    }

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

    override fun onBindViewHolder(holder: HomeGameTestV2RecommendViewHolder, position: Int) {
        val label = data.getOrElse(position) { RecommendLabel() }
        holder.bind(label)
    }

}