package com.yidianling.im.session.viewholder.adapter

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.im.R

/**
 * @author huozhiliang
 * @描述:
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2020/9/7
 */
class AdapterBusinessCard : RecyclerView.Adapter<AdapterBusinessCard.ViewHolder>() {
    private lateinit var tagList:List<String>

    class ViewHolder(itemView: View) :
        RecyclerView.ViewHolder(itemView) {
        val tagsTV: TextView = itemView.findViewById(R.id.tagsTV)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        return ViewHolder(
            LayoutInflater.from(parent.context).inflate(
                R.layout.im_message_item_single_text,
                parent,
                false
            )
        )
    }

    override fun getItemCount(): Int {
        return tagList.size?:0
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.tagsTV.text = tagList[position]
    }
    fun setTagData(data: List<String>) {
        tagList = data
        notifyDataSetChanged()
    }

}