package com.cooleshow.student.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cooleshow.base.utils.GlideUtils;
import com.cooleshow.student.R;
import com.cooleshow.student.bean.HotAlbumBean;

import java.util.List;

/**
 * 创建日期：2022/5/27 11:51
 *
 * @author Ryan
 * 类说明：
 */
public class HomeHotAlbumAdapter extends BaseQuickAdapter<HotAlbumBean.RowsBean, BaseViewHolder> {

    public HomeHotAlbumAdapter() {
        super(R.layout.layout_home_hot_album_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, HotAlbumBean.RowsBean item) {
        ImageView im_pic = helper.getView(R.id.im_pic);
        ImageView iv_icon = helper.getView(R.id.iv_icon);
        iv_icon.setImageResource(item.favorite == 1 ? R.drawable.icon_hot_album_collect_num_tag2 : R.drawable.icon_hot_album_collect_num_tag);
        GlideUtils.INSTANCE.loadImage(getContext(), item.albumCoverUrl, im_pic);
        TextView tv_collect_num = helper.getView(R.id.tv_collect_num);
        tv_collect_num.setText(String.format("%d人", item.albumFavoriteCount));
        helper.setText(R.id.album_name, item.albumName);
    }
}
