package com.swago.home.innerhome

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.google.android.material.imageview.ShapeableImageView
import com.swago.baseswago.model.MomentModel
import com.swago.baseswago.model.home.HomeModel
import com.swago.home.R

/**
 *@date 2021/11/27 15:23
 *description:
 */
class HomeAdapter  : BaseQuickAdapter<MomentModel, BaseViewHolder>(R.layout.item_home, arrayListOf()) {

    override fun convert(helper: BaseViewHolder, item: MomentModel) {
        helper.apply {
            setText(R.id.tvName,item.user_name)
            if (item.user_sex == 1){
                setImageResource(R.id.ivSex,R.mipmap.female)
            }else{
                setImageResource(R.id.ivSex,R.mipmap.male)
            }
            val imageView = itemView.findViewById<ShapeableImageView>(R.id.ivAvatar)
            Glide.with(itemView.context).load(item.user_head_img_url).centerCrop().into(imageView)
            setText(R.id.tvHot,item.broadcast_hot)
//            setImageResource(R.id.ivCountry,R.drawable.flag_ac)
        }
    }
}