package com.abbidot.tracker.adapter

import android.content.Context
import androidx.core.content.ContextCompat
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.list.RecyclerViewHolder
import com.abbidot.baselibrary.util.AppUtils
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.DataBean
import com.qmuiteam.qmui.widget.QMUIRadiusImageView

/**
 *Created  by .yzq on 2024/2/22/022.
 * @link
 * @description:
 */
class FamilyAvatarAdapter(
    ctx: Context, list: MutableList<DataBean>?
) : BaseRecyclerAdapter<DataBean>(ctx, list) {

    override fun getEmptyLayoutId(viewType: Int) = 0

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

    override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
        val qMUIRadiusImageView =
            holder!!.getView(R.id.il_invite_family_avatar_layout) as QMUIRadiusImageView
        qMUIRadiusImageView.apply {
            setImageResource(item.imageId)
            borderColor = ContextCompat.getColor(mContext, R.color.select_color)
            borderWidth = if (item.selected) {
                AppUtils.dpToPx(2)
            } else {
                AppUtils.dpToPx(0)
            }
        }
    }
}