package com.cooleshow.teacher.adapter;

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

/**
 * 创建日期：2022/5/24 10:40
 *
 * @author Ryan
 * 类说明：
 */
public class WithdrawalFilterAdapter extends BaseQuickAdapter<WithdrawalFilterBean, BaseViewHolder> {
    private int selectPosition = -1;

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

    @Override
    protected void convert(@NonNull BaseViewHolder holder, WithdrawalFilterBean bean) {
        holder.setText(R.id.tv_title, bean.showText);
        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();
    }
}
