@@ -0,0 +1,1789 @@
+package cc.rainwave.android.widget;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Locale;%0A%0Aimport android.widget.Filter;%0A%0A/**%0A * This filter uses the toString() method of the input type to do a .contains()%0A * to match the search constraint. The result is a more permissive filter that%0A * users are more used to seeing.%0A * %0A * @param %3CT%3E%0A *            type of object to filter on%0A */%0Apublic abstract class SubsequenceFilter%3CT%3E extends Filter %7B%0A%0A    private boolean mIgnoreCase;%0A%0A    private List%3CT%3E mSearchSet;%0A%0A    public SubsequenceFilter(boolean ignoreCase, T%5B%5D searchSet) %7B%0A        this(ignoreCase, Arrays.asList(searchSet));%0A    %7D%0A%0A    public SubsequenceFilter(boolean ignoreCase, List%3CT%3E searchSet) %7B%0A        mIgnoreCase = ignoreCase;%0A        mSearchSet = searchSet;%0A    %7D%0A%0A    @Override%0A    protected FilterResults performFiltering(CharSequence constraint) %7B%0A        String text = constraint != null ? constraint.toString() : null;%0A        FilterResults results = new FilterResults();%0A        if (text != null && mIgnoreCase) %7B%0A            text = text.toLowerCase(Locale.US);%0A        %7D%0A        if (text == null %7C%7C text.length() == 0) %7B%0A            results.values = mSearchSet;%0A            results.count = mSearchSet.size();%0A            return results;%0A        %7D%0A%0A        // Do the actual search%0A        List%3CT%3E matchList = new ArrayList%3CT%3E();%0A        for (T item : mSearchSet) %7B%0A            String repr = item.toString();%0A            if (mIgnoreCase) %7B%0A                repr = repr.toLowerCase(Locale.US);%0A            %7D%0A            if (repr.contains(constraint)) %7B%0A                matchList.add(item);%0A            %7D%0A        %7D%0A        results.values = matchList;%0A        results.count = matchList.size();%0A        return results;%0A    %7D%0A%7D%0A

write class SubsequenceFilter