package com.abbidot.tracker.adapter

import android.content.Context
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.list.RecyclerViewHolder
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.FamilyBean
import com.abbidot.tracker.constant.ConstantInt

/**
 *Created  by .yzq on 2023/12/25/025.
 * @link
 * @description:
 */
class HomePetFamilyAdapter(
    ctx: Context, list: MutableList<FamilyBean>?
) : BaseRecyclerAdapter<FamilyBean>(ctx, list) {

    override fun getEmptyLayoutId(viewType: Int) = R.layout.layout_family_empty_view

    override fun getItemLayoutId(viewType: Int) = R.layout.item_home_pet_family

    override fun bindData(holder: RecyclerViewHolder?, position: Int, item: FamilyBean) {
        holder!!.setText(R.id.item_home_pet_family_name, item.acceptEmail)
        val avatarImageView = holder.getImageView(R.id.item_home_pet_family_head)

        val avatarImageResId = if (item.avatar == ConstantInt.Man) {
            R.drawable.icon_family_boy_avatar
        } else {
            R.drawable.icon_family_girl_avatar
        }
        avatarImageView.setImageResource(avatarImageResId)
    }
}