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

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
import com.cheng.blzb.R
import com.cheng.blzb.bean.HotWordEntity
import com.cheng.blzb.common.Constants


class GuideVipIndustryAdapter(val context: Context, val data: List<HotWordEntity.Child>): BaseAdapter() {
    override fun getCount(): Int {
        return data.size
    }

    override fun getItem(position: Int): HotWordEntity.Child {
        return data[position]
    }

    override fun getItemId(position: Int): Long {
        return position.toLong()
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
        val view: View
        val viewHolder: ViewHolder
        if (convertView == null) {
            view = View.inflate(context, R.layout.listitem_guide_vip_industry, null)
            viewHolder = ViewHolder(view)
            view.tag = viewHolder
        } else {
            view = convertView
            viewHolder = convertView.tag as ViewHolder
        }
        viewHolder.tvName.typeface = Constants.ysbth
        viewHolder.tvName.text = getItem(position).name
        return view
    }

    inner class ViewHolder(val view: View) {
        val tvName: TextView = view.findViewById(R.id.tv_name)
    }
}