package com.cooleshow.teacher.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cooleshow.teacher.R;
import com.cooleshow.teacher.bean.CourseFilterStatusBean;

import androidx.annotation.NonNull;

/**
 * Author by pq, Date on 2022/4/25.
 */
public class CourseStatusFilterAdapter extends BaseQuickAdapter<CourseFilterStatusBean, BaseViewHolder> {
    private int selectPosition = -1;

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

    @Override
    protected void convert(@NonNull BaseViewHolder holder, CourseFilterStatusBean bean) {
        holder.setText(R.id.tv_title, bean.showText);
        TextView tv_title = holder.getView(R.id.tv_title);
        if(holder.getLayoutPosition() == selectPosition){
            tv_title.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
        }else{
            tv_title.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.black_333));
        }
    }

    public int getSelectPosition() {
        return selectPosition;
    }

    public void setSelect(int selectPosition) {
        this.selectPosition = selectPosition;
        notifyDataSetChanged();
    }
}
