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.HomeLiveAndVideoBean;

import java.util.List;

/**
 * 创建日期：2022/5/27 14:51
 *
 * @author Ryan
 * 类说明：
 */
public class HomeVideoCourseAdapter extends BaseQuickAdapter<HomeLiveAndVideoBean.VideoCourseBean, BaseViewHolder> {

    public HomeVideoCourseAdapter(List<HomeLiveAndVideoBean.VideoCourseBean> data) {
        super(R.layout.layout_home_video_course_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeLiveAndVideoBean.VideoCourseBean item) {
        ImageView im_pic = helper.getView(R.id.im_pic);
        GlideUtils.INSTANCE.loadImage(getContext(), item.lessonCoverUrl, im_pic);
        GlideUtils.INSTANCE.loadImage(getContext(), item.avatar, helper.getView(R.id.teacher_header),R.drawable.icon_student_default_head);
        helper.setText(R.id.subject_name,item.subjectName);
        TextView tv_title = helper.getView(R.id.tv_title);
        tv_title.setText(item.videoGroupName);
        TextView tv_teacher_name = helper.getView(R.id.tv_teacher_name);
        tv_teacher_name.setText(item.teacherName);
        TextView tv_price = helper.getView(R.id.tv_price);
        tv_price.setText(item.lessonPrice + "");
        TextView tv_course_num = helper.getView(R.id.tv_course_num);
        tv_course_num.setText(item.lessonCount + "课时");
    }
}
