package com.renrenliao.im.ui.adapter

import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.renrenliao.im.R
import com.renrenliao.im.bean.UserInfo

import com.renrenliao.im.utils.GlideUtils

/**
 **@ClassName FriendSortAdapter
 **@Description
 **@Author gan
 **@Date 2022/5/27 18:52
 **/
class FriendSortAdapter:BaseQuickAdapter<UserInfo,BaseViewHolder>(R.layout.item_sort_friend) {

    override fun convert(holder: BaseViewHolder, item: UserInfo) {
        //holder.setText(R.id.title_name,item.nickname)
        val tvName = holder.getView<TextView>(R.id.tv_name)
        val tvStatus = holder.getView<TextView>(R.id.tv_status)
        val ivAvatar = holder.getView<ImageView>(R.id.iv_avatar)
        tvName.text = item.nickname
        if (item.liveStatus == 1){
            tvStatus.text = "在线"
        }else{
            tvStatus.text = "离线"
        }
        GlideUtils.loadUserImage(ivAvatar,item.getAvatarUrl())
    }
}