1package org.skia.viewer;
4import android.widget.ArrayAdapter;
8import java.util.ArrayList;
12 private String mCurrentOption;
14 private Filter mFilter =
null;
15 private Spinner mSpinner;
25 this.mCurrentOption = currentOption;
28 private class OptionFilter
extends Filter {
31 protected FilterResults performFiltering(CharSequence constraint) {
32 final String pattern = constraint.toString().toLowerCase();
33 ArrayList<String> filteredOptions =
new ArrayList<>();
34 for(String option : mOptions) {
35 if (option.equals(mCurrentOption)
36 || option.toLowerCase().indexOf(pattern) > -1) {
37 filteredOptions.add(option);
40 FilterResults results =
new FilterResults();
41 results.values = filteredOptions;
42 results.count = filteredOptions.size();
47 protected void publishResults(CharSequence constraint, FilterResults results) {
50 addAll(filteredOptions);
52 mSpinner.setSelection(filteredOptions.indexOf(mCurrentOption));
53 notifyDataSetChanged();
59 if (mFilter ==
null) {
60 mFilter =
new OptionFilter();
static SkString resource(SkPDFResourceType type, int index)
void setCurrentOption(String currentOption)
OptionAdapter(Context context, int resource, List< String > options, Spinner spinner)
GrSamplerState::Filter Filter