@@ -0,0 +1,1682 @@
+package cc.rainwave.android.adapters;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport android.content.Context;%0Aimport android.widget.ArrayAdapter;%0Aimport android.widget.Filter;%0Aimport cc.rainwave.android.widget.SubsequenceFilter;%0A%0A/**%0A * This is just a dumb extension of ArrayAdapter to override the default filter%0A * with a case-insensitive SubsequenceFilter%3CT%3E.%0A * %0A * @param %3CT%3E%0A *            type parameter to pass on to ArrayAdapter%0A */%0Apublic class FilterableAdapter%3CT%3E extends ArrayAdapter%3CT%3E %7B%0A%0A    private Filter mFilter;%0A%0A    private List%3CT%3E mObjects;%0A%0A    public FilterableAdapter(Context context, int resource, T%5B%5D objects) %7B%0A        this(context, resource, Arrays.asList(objects));%0A    %7D%0A%0A    public FilterableAdapter(Context context, int resource, List%3CT%3E objects) %7B%0A        super(context, resource, objects);%0A        mObjects = objects;%0A    %7D%0A%0A    @Override%0A    public int getCount() %7B%0A        return mObjects.size();%0A    %7D%0A%0A    public T getItem(int i) %7B%0A        return mObjects.get(i);%0A    %7D%0A%0A    @Override%0A    public Filter getFilter() %7B%0A        if (mFilter == null) %7B%0A            mFilter = new SubsequenceFilter%3CT%3E(true, mObjects) %7B%0A                @SuppressWarnings(%22unchecked%22)%0A                @Override%0A                protected void publishResults(CharSequence constraint,%0A                        FilterResults results) %7B%0A                    mObjects = (List%3CT%3E) results.values;%0A                    if (results.count == 0) %7B%0A                        notifyDataSetInvalidated();%0A                    %7D else %7B%0A                        notifyDataSetChanged();%0A                    %7D%0A                %7D%0A            %7D;%0A        %7D%0A        return mFilter;%0A    %7D%0A%7D%0A

write class FilterableAdapter