package com.swago.user.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.swago.baseswago.model.BlackListModel
import com.swago.user.R
import de.hdodenhof.circleimageview.CircleImageView

/**
 *@date 2021/8/28 14:28
 *description:
 */
class BlackListAdapter: BaseQuickAdapter<BlackListModel.ListBean, BaseViewHolder>(R.layout.item_black, arrayListOf()) {

    override fun convert(helper: BaseViewHolder, item: BlackListModel.ListBean) {
        helper.apply {
            setText(R.id.tvName,item.user_name)
            setText(R.id.tvCreateTIme,item.created_at)
            if (item.user_sex==0){
                setImageResource(R.id.ivSex,R.mipmap.male)
            }else{
                setImageResource(R.id.ivSex,R.mipmap.female)
            }

            val ivAvatar = itemView.findViewById<CircleImageView>(R.id.ivAvatar)
            Glide.with(itemView.context).load(item.user_head_img_url)
                .placeholder(R.mipmap.default_avatar)
                .error(R.mipmap.default_avatar).into(ivAvatar)
            addOnClickListener(R.id.ivStatus)
        }

    }
}