package com.dahe.mylibrary.wapper;

import android.widget.TextView;

import androidx.annotation.Nullable;

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

import java.util.List;

public class SelectSimAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private String selectString = "";


    public SelectSimAdapter(int layoutResId, @Nullable List<String> data, String selectString) {
        super(R.layout.item_select, data);
        this.selectString = selectString;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_content,item);
        TextView tv = helper.getView(R.id.tv_content);
        if (item.equals(selectString)){
            tv.setSelected(true);
        }else{
            tv.setSelected(false);
        }

    }

    public void setSelect(String selectString){
        this.selectString = selectString;
    }
}
