package com.bc_chat.circle.adapetr

import android.content.Context
import android.view.View
import com.bc_chat.bc_base.entity.Hudgens
import com.bc_chat.contacts.R
import com.bc_chat.contacts.databinding.ItemHudgensLayoutBinding
import com.zhaohaoting.framework.abs.adapter.ListToAdapter
import com.zhaohaoting.framework.utils.Check
import com.zhaohaoting.framework.utils.glid.GlideUtils

/**
 * author：Created by zhaohaoting on 2019/8/29
 * email：526309416@qq.com
 * desc：
 */
class HudgensAdapter(context: Context) : ListToAdapter<Hudgens, List<Hudgens>>(context) {

    override fun getItemLayoutId(type: Int): Int = R.layout.item_hudgens_layout

    override fun onBindViewHolderHF(baseViewHolder: BaseViewHolder<*>?, realPosition: Int, data: Hudgens?) {
        val binding = baseViewHolder?.dataBinding as ItemHudgensLayoutBinding
        GlideUtils.loadCircleImage(context, data?.photo, binding.ivPhoto)
        binding.tvLabel.text = data?.label
        if (Check.isEmpty(data?.label)) {
            binding.tvLabel.visibility = View.GONE
        } else {
            binding.tvLabel.visibility = View.VISIBLE
        }
        binding.tvName.text = data?.nickname
    }
}