package com.cooleshow.base.widgets.poplist;

import android.widget.TextView;

import androidx.annotation.NonNull;

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

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

    public CourseStatusFilterAdapter() {
        super(R.layout.notice_popu_list_item);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, PopMenuBean bean) {
        holder.setText(R.id.tv_title, bean.getActionName());
        TextView tv_title = holder.getView(R.id.tv_title);
        if (getItemPosition(bean) == 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();
    }
}
