package com.wisewoods.eduandroid.ui.adapter;

import android.widget.TextView;

import com.wisewoods.base.base.BaseVH;
import com.wisewoods.base.bean.ScheduleInfo;
import com.wisewoods.base.page.BasePageAdapter;
import com.wisewoods.base.utils.$;
import com.wisewoods.eduandroid.R;

import org.jetbrains.annotations.NotNull;

public class LiveListAdapter extends BasePageAdapter<ScheduleInfo.DataBean> {
    public LiveListAdapter() {
        super(R.layout.item_recycler_live_list);
    }

    @Override
    protected void convert(@NotNull BaseVH baseVH, ScheduleInfo.DataBean dataBean) {
        TextView tvTag = baseVH.getView(R.id.tv_tag);
        if (dataBean.liveStatus == 0) {
            baseVH.setBackgroundResource(R.id.tv_tag, R.drawable.shape_live_offline_tag)
                    .setText(R.id.tv_tag, "待直播  " + $.timeFormat6(dataBean.courseStartTime) + "开始");
        } else if (dataBean.liveStatus == 1) {
            baseVH.setBackgroundResource(R.id.tv_tag, R.drawable.shape_live_online_tag)
                    .setText(R.id.tv_tag, "直播中");
        } else if (dataBean.liveStatus == 2) {
            baseVH.setBackgroundResource(R.id.tv_tag, R.drawable.shape_live_offline_tag)
                    .setText(R.id.tv_tag, "已结束");
        }

        baseVH.setText(R.id.tv_name, dataBean.courseCeremoneyName)
                .setText(R.id.tv_num, dataBean.OnlineMemberNum + "人在线观看")
                .setText(R.id.tv_des, dataBean.courseSynopsis)
                .setNetUrl(R.id.iv_cover, dataBean.courseThumbnailUrl, R.drawable.ic_default_live_cover)
        ;
    }
}
