package com.bc_chat.contacts.adapter

import android.content.Context
import com.bc_chat.bc_base.entity.UserInfo
import com.bc_chat.contacts.R
import com.bc_chat.contacts.databinding.ItemLayoutMemberBinding
import com.zhaohaoting.framework.abs.adapter.AbsRecyclerAdapter
import com.zhaohaoting.framework.abs.adapter.ListToAdapter
import com.zhaohaoting.framework.utils.glid.GlideUtils


/**
 * author：Created by zhaohaoting on 2019/2/27
 * email：526309416@qq.com
 * desc：
 */
class MemberListAdapter constructor(context: Context, contactList: List<UserInfo>) : ListToAdapter<UserInfo, List<UserInfo>>(context, contactList) {

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

    override fun isEmpty(): Boolean {
        return false
    }

    override fun onBindViewHolderHF(baseViewHolder: AbsRecyclerAdapter.BaseViewHolder<*>, realPosition: Int, contacts: UserInfo) {
        val dataBinding = baseViewHolder.dataBinding as ItemLayoutMemberBinding
        dataBinding.tvName.text = contacts.remark ?: contacts.nickname
        GlideUtils.loadCircleImage(context, contacts.photo, dataBinding.ivHeader)
    }
}
