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/14 13:32
 *description:
 */
class FollowFanAdapter(private val type:Int) : BaseQuickAdapter<BlackListModel.ListBean,BaseViewHolder>(R.layout.item_follow_fan, arrayListOf()) {

    override fun convert(helper: BaseViewHolder, item: BlackListModel.ListBean) {

        helper.apply {
            setText(R.id.tvName,item.user_name)
            setText(R.id.tvSign,item.user_signature)
            if (item.user_sex==0){
                setImageResource(R.id.ivSex,R.mipmap.male)
            }else{
                setImageResource(R.id.ivSex,R.mipmap.female)
            }

            /**
             * 0 关注列表
             * 1 粉丝列表
             */
            if (type==0){
                setVisible(R.id.ivStatus,true)
                setImageResource(R.id.ivStatus,R.mipmap.followed)
                addOnClickListener(R.id.ivStatus)
            }else{
                setVisible(R.id.ivStatus,false)
            }

            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).centerCrop().into(ivAvatar)
        }


    }
}