package com.cooleshow.teacher.adapter;

import android.widget.ImageView;
import android.widget.RatingBar;

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.teacher.R;
import com.cooleshow.teacher.bean.ReceivedCommentListBean;

import androidx.annotation.NonNull;

/**
 * Author by pq, Date on 2022/5/5.
 */
public class ReceivedCommentListAdapter extends BaseQuickAdapter<ReceivedCommentListBean.RowsBean, BaseViewHolder> implements LoadMoreModule {

    public ReceivedCommentListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, ReceivedCommentListBean.RowsBean bean) {
        //头像
        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
        GlideUtils.INSTANCE.loadImage(getContext(), bean.avatar, iv_avatar, R.drawable.icon_teacher_default_head);
        //名称
        holder.setText(R.id.tv_title, bean.userName);
        //声部名称
        holder.setText(R.id.tv_course_name, bean.subjectName);
        //时间
        holder.setText(R.id.tv_time, bean.startTime);
        //评价内容
        holder.setText(R.id.tv_comment_content, bean.studentReplied);
        //评分
        RatingBar ratingBar = holder.getView(R.id.rating_bar_for_student);
        ratingBar.setRating(bean.score);
    }

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