package com.cooleshow.student.adapter;

import android.os.Build;
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.UiUtils;
import com.cooleshow.student.R;
import com.cooleshow.student.bean.HomeStyleBean;

import java.util.List;

import io.rong.imkit.picture.tools.MediaUtils;

/**
 * 创建日期：2022/5/27 16:13
 *
 * @author Ryan
 * 类说明：
 */
public class HomeTeacherStyleAdapter extends BaseQuickAdapter<HomeStyleBean.RowsBean, BaseViewHolder> {

    public HomeTeacherStyleAdapter(List<HomeStyleBean.RowsBean> data) {
        super(R.layout.layout_home_teacher_style_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeStyleBean.RowsBean item) {
        ImageView im_pic = helper.getView(R.id.im_pic);
        TextView tv_title = helper.getView(R.id.tv_title);
        ImageView im_teacher_header = helper.getView(R.id.im_teacher_header);
        TextView tv_teacher_name = helper.getView(R.id.tv_teacher_name);
        TextView tv_watch_count = helper.getView(R.id.tv_watch_count);
        GlideUtils.INSTANCE.loadVideoThumbnail(getContext(), item.videoUrl, im_pic);
        tv_title.setText(item.describe);
        GlideUtils.INSTANCE.loadImage(getContext(), item.avatar, im_teacher_header);
        tv_teacher_name.setText(item.username);
        tv_watch_count.setText(item.browse + "人观看");

        if (item.liveing != null) {
            helper.setVisible(R.id.liveing_text, true);
        } else {
            helper.setVisible(R.id.liveing_text, false);
        }
    }
}
