Searchable recycler view
This tiny library helps you to make your recycler views searchable.
Android studio with gradle version 3.0+
Add this items in your build.gradle file
Step 1:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2:
dependencies {
implementation 'com.github.MoeidHeidari:SearchableRecyclerView:0.1.0'
}
Steps 1 :
Add it to your *.xml file
<com.example.searchablerecyclerview2.SearchableRecyclerView
android:id="@+id/MainRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Steps 2 :
In your activity
recyclerView.performSearch(YourListItems,yourEditText,ViewModel.class);
mainRecyclerView.setSearchListener(new SearchableRecyclerView.RecyclerSearchListener() {
@Override
public void foundedItems(List<?> foundeds)
{
//update the recycler view with founded items and also cast the founded items to your own type
// (List<ViewModel>)foundeds
}
});
- Moeid Heidari
This project is licensed under the MIT License - see the LICENSE.md file for details