package com.abbidot.tracker.adapter

import android.content.Context
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

/**
 *Created  by .yzq on 2021/12/30/030.
 * @link
 * @description:
 */
class PetsBadgesAdapter(ctx: Context, list: MutableList<DataBean>?,itemViewWidthDp:Int=80) :
    BaseRecyclerAdapter<DataBean>(ctx, list) {

    private val mItemViewWidthDp=AppUtils.dpToPx(itemViewWidthDp)

    override fun getEmptyLayoutId(viewType: Int) = 0

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

    override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
        holder!!.getTextView(R.id.tv_item_my_pets_badge).apply {
            text = item.name
        }
        holder.itemView.layoutParams.width= mItemViewWidthDp
        holder.getImageView(R.id.iv_item_my_pets_badge).setImageResource(item.imageId)
    }
}