package com.cooleshow.teacher.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.module.BaseLoadMoreModule;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cooleshow.base.utils.GlideUtils;
import com.cooleshow.base.utils.UiUtils;
import com.cooleshow.teacher.R;
import com.cooleshow.teacher.bean.PianoRoomCourseListBean;
import com.cooleshow.teacher.bean.SparringCourseListBean;
import com.cooleshow.teacher.constants.CourseConstants;

import androidx.annotation.NonNull;


/**
 * Author by pq, Date on 2022/4/25.
 */
public class PianoRoomCourseListAdapter extends BaseQuickAdapter<PianoRoomCourseListBean.RowsBean, BaseViewHolder> implements LoadMoreModule {

    public PianoRoomCourseListAdapter() {
        super(R.layout.item_piano_room_course_list_layout);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, PianoRoomCourseListBean.RowsBean data) {
        if (data == null) {
            return;
        }
        //时间
        holder.setText(R.id.tv_time, UiUtils.getCourseTimeString(data.startTime, data.endTime));
        //title
        holder.setText(R.id.tv_title, data.groupName);
        //subjectName
        holder.setText(R.id.tv_course_name, data.subjectName);
        holder.setText(R.id.tv_buy_num, data.studentCount + "人");
        TextView tv_course_status = holder.getView(R.id.tv_course_status);

        if (TextUtils.equals(CourseConstants.COURSE_STATUS_NOT_START, data.status)) {
            //未开始
            tv_course_status.setText("未开始");
            tv_course_status.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_ff802c));
        }

        if (TextUtils.equals(CourseConstants.COURSE_STATUS_ING, data.status)) {
            //进行中
            tv_course_status.setText("进行中");
            tv_course_status.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
        }

        if (TextUtils.equals(CourseConstants.COURSE_STATUS_COMPLETE, data.status)) {
            //已结束
            tv_course_status.setText("已结束");
            tv_course_status.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
        }
    }

    @NonNull
    @Override
    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
        return new BaseLoadMoreModule(baseQuickAdapter);
    }
}
