package com.wd.workoffice.ui.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;

import java.util.List;

/**
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class FilterAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public int choosePos = 0;

    public FilterAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    public int getChoosePos() {
        return choosePos;
    }

    public void setChoosePos(int choosePos) {
        this.choosePos = choosePos;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        if (helper.getAdapterPosition() == choosePos) {
            helper.setBackgroundColor(R.id.tv_name, Color.parseColor("#ffeaf3fe"));
            helper.setTextColor(R.id.tv_name, Color.parseColor("#2F89FC"));
        } else {
            helper.setTextColor(R.id.tv_name, helper.itemView.getContext().getResources().
                    getColor(R.color.flexible_text_color));
            helper.setBackgroundColor(R.id.tv_name, Color.WHITE);
        }
        helper.setText(R.id.tv_name, item);
    }
}
