package com.cooleshow.student.adapter;

import android.text.TextUtils;
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.base.utils.TimeUtils;
import com.cooleshow.student.R;
import com.cooleshow.student.bean.HomeLiveAndVideoBean;
import com.cooleshow.student.bean.HotAlbumBean;

import java.util.List;

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

    public HomeLiveCourseAdapter(List<HomeLiveAndVideoBean.CourseBean> data) {
        super(R.layout.layout_home_live_course_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeLiveAndVideoBean.CourseBean item) {
        ImageView im_pic = helper.getView(R.id.im_pic);
        GlideUtils.INSTANCE.loadImage(getContext(), item.backgroundPic, im_pic);
        GlideUtils.INSTANCE.loadImage(getContext(), item.avatar, helper.getView(R.id.teacher_header),R.drawable.icon_student_default_head);
        TextView tv_title = helper.getView(R.id.tv_title);
        tv_title.setText(item.courseGroupName);
        helper.setText(R.id.subject_name,item.subjectName);
        TextView tv_teacher_name = helper.getView(R.id.tv_teacher_name);
        tv_teacher_name.setText(item.teacherName);
        TextView tv_start_time = helper.getView(R.id.tv_start_time);
        tv_start_time.setText(TextUtils.isEmpty(item.courseStartTime) ? "" : TimeUtils.date2String(TimeUtils.string2Date(item.courseStartTime), "MM月dd日 HH:mm"));
        TextView tv_price = helper.getView(R.id.tv_price);
        tv_price.setText(item.courseGroupPrice + "");
        TextView tv_course_num = helper.getView(R.id.tv_course_num);
        tv_course_num.setText(item.courseNum + "课时");
    }
}
