ribot / easy-adapter

[DEPRECATED] Easy Adapters library for Android
http://ribot.github.io
Apache License 2.0
421 stars 50 forks source link

Why not support adapter.getFilter ()? #28

Closed jhonvidal closed 9 years ago

jhonvidal commented 9 years ago

How to turn ArrayAdapter? to Acknowledge getFilter() How to implement a search EasyAdapter?

Help Please :)

ivacf commented 9 years ago

Hi, EasyAdapter extends BaseAdapter so it cannot be cast to an ArrayAdapter. If you want to use getFilter() you will have to create your own adapter that extends BaseEasyAdapter and implements android.widget.Filterable

jhonvidal commented 9 years ago

thanks !!

MFlisar commented 9 years ago

Here's a gist for those who want to use a filter for RecyclerView:

https://gist.github.com/MFlisar/846e9607ffb6b330701f

It supports animations for insert, delete and move.

just call

adapter.filter(new IPredicate<T>() {
    @Override
     public boolean apply(T data) {
         // return true if data should be part of the filtered list
     }
});

Btw, you can include this directly into your library if you like it and want to...