package com.cheng.blzb.ui.fragment.guide.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.blzb.R
import com.cheng.blzb.bean.HotWordEntity
import com.cheng.blzb.common.Constants

class GuideItem5IndustryAdapter(val context: Context, val data: MutableList<HotWordEntity.Child>): RecyclerView.Adapter<BaseViewHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
        val view = View.inflate(context, R.layout.listitem_guide_item5_industry, null)
        return BaseViewHolder(view)
    }

    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        holder.getView<TextView>(R.id.tv_name).typeface = Constants.ysbth
        holder.setText(R.id.tv_name, data[position % data.size].name)
    }

    override fun getItemCount(): Int {
        if (data.isNotEmpty()) {
            return Int.MAX_VALUE
        }
        return 0
    }

}