package com.bc_chat.contacts.adapter

import android.content.Context
import com.bc_chat.bc_base.entity.group.Group
import com.bc_chat.contacts.R
import com.bc_chat.contacts.databinding.ItemLayoutGroupBinding
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 GroupListAdapter constructor(context: Context) : ListToAdapter<Group, List<Group>>(context) {

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

    override fun onBindViewHolderHF(baseViewHolder: AbsRecyclerAdapter.BaseViewHolder<*>, realPosition: Int, contacts: Group) {
        val dataBinding = baseViewHolder.dataBinding as ItemLayoutGroupBinding
        GlideUtils.loadCircleImage(context, contacts.photo, dataBinding.ivHeader)
        dataBinding.tvName.text = contacts.group_name
    }
}
