Description
RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.
RecyclerViewHelper alternatives and similar packages
Based on the "Adapter" category.
Alternatively, view RecyclerViewHelper alternatives based on common mentions on social networks and blogs.
-
Epoxy
Epoxy is an Android library for building complex screens in a RecyclerView -
FastAdapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction... -
SectionedRecyclerViewAdapter
An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually. -
Renderers
Renderers is an Android library created to avoid all the boilerplate needed to use a RecyclerView/ListView with adapters. -
MultiChoiceAdapter
Android - A ListView adapter with support for multiple choice modal selection -
AutoplayVideos
Android library to auto-play/pause videos from url in recyclerview. -
SlimAdapter
A slim & clean & typeable Adapter without# VIEWHOLDER -
easy-adapter
[DEPRECATED] Easy Adapters library for Android -
EfficientAdapter
Create a new adapter for a RecyclerView or ViewPager is now much easier. -
SmartRecyclerAdapter
Small, smart and generic adapter for recycler view with easy and advanced data to ViewHolder binding. -
adapter-kit
Adapter Kit is a set of useful adapters for Android. -
FunDapter
Simplify Adapter creation for your Android ListViews. -
GridListViewAdapters
This library provides GridAdapters(ListGridAdapter & CursorGridAdapter) which enable you to bind your data in grid card fashion within android.widget.ListView, Also provides many other features related to GridListView. -
Items
Generate data-view-binding adapters of android recycler view. -
instant-adapter
Just like instant coffee, saves 78% of your time on Android's Custom Adapters. -
EasyListViewAdapters
This library provides Easy Android ListView Adapters(EasyListAdapter & EasyCursorAdapter) which makes designing Multi-Row-Type ListView very simple & cleaner, It also provides many useful features for ListView. -
AutoAdapter
This Repository simplifies working with RecyclerView Adapter -
Preview Image Collection
A library to make a mosaic with a preview of multiple images -
IntentSharingAnim
Intent sharing between activities of views with animation -
Android-BasicAdapter
No separate adapter files for not-so-complex RecyclerViews -
Suggestive ๐
An Android UI library that allows easy implementation of (text) input suggestion popup windows. -
MultiLevelAdapter
Android library to allow collapsing and expanding items in RecyclerView's Adapter on multiple levels -
Register-Yourself
This app uses SQLite database to sign-up and register a user
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of RecyclerViewHelper or a related project?
README
Android library that provides most common functions around recycler-view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items. <!-- Bintray --> <!-- API --> <!-- Android Arsenal --> <!-- Android Dev Digest --> <!-- Android Weekly --> <!-- GitHub stars --> <!-- GitHub forks --> <!-- GitHub watchers --> <!-- Say Thanks! --> <!-- GitHub followers --> <!-- Twitter Follow -->
Also featured in Awesome Android Newsletter #Issue 21
Built with โค๏ธ by Nishant Srivastava and contributors
Note: Development for pre-androidx version of this library has stopped. If you are looking for pre-androidx version, then checkout this branch. Library is compatible with AndroidX version only.
Integration
RecyclerViewHelper is available in the Jcenter, so getting it as simple as adding it as a dependency
def recyclerViewVersion="{latest version}"
// Required
implementation "androidx.recyclerview:recyclerview:${recyclerViewVersion}"
// RecyclerViewHelper
implementation "com.github.nisrulz:recyclerviewhelper:x${recyclerViewVersion}"
where {latest version}
corresponds to published version in without the prepended
x
.
This is done to distinguish between library using andoirdx vs pre-androidx.
Usage Example:
def recyclerViewVersion="1.1.0"
// Required
implementation "androidx.recyclerview:recyclerview:${recyclerViewVersion}"
// RecyclerViewHelper
implementation "com.github.nisrulz:recyclerviewhelper:x${recyclerViewVersion}"
NOTE : The version here corresponds to the version of recyclerview dependency.
Make sure that the google's maven repo is declared in your projects build.gradle
file as below
allprojects {
repositories {
google()
jcenter()
}
}
Usage
Implement the
RHVAdapter
in your recycler view adapter andRHVViewHolder
in your ItemViewHolderpublic class MyAdapter extends RecyclerView.Adapter<MyAdapter.ItemViewHolder> implements RVHAdapter { ... @Override public boolean onItemMove(int fromPosition, int toPosition) { swap(fromPosition, toPosition); return false; } @Override public void onItemDismiss(int position, int direction) { remove(position); } public class ItemViewHolder extends RecyclerView.ViewHolder implements RVHViewHolder { ... @Override public void onItemSelected(int actionstate) { System.out.println("Item is selected"); } @Override public void onItemClear() { System.out.println("Item is unselected"); } } // Helper functions you might want to implement to make changes in the list as an event is fired private void remove(int position) { dataList.remove(position); notifyItemRemoved(position); } private void swap(int firstPosition, int secondPosition) { Collections.swap(dataList, firstPosition, secondPosition); notifyItemMoved(firstPosition, secondPosition); } }
+ Then implement your recycler view
```java
public class MainActivity extends AppCompatActivity {
RecyclerView myrecyclerview;
ArrayList<String> data;
MyAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myrecyclerview = (RecyclerView) findViewById(R.id.rv_fruits);
data = new ArrayList<>();
data.add("Apple");
...
data.add("Fig");
// Setup your adapter
adapter = new MyAdapter(data);
// Setup
myrecyclerview.hasFixedSize();
myrecyclerview.setLayoutManager(new LinearLayoutManager(this));
myrecyclerview.setAdapter(adapter);
// Setup onItemTouchHandler to enable drag and drop , swipe left or right
ItemTouchHelper.Callback callback = new RVHItemTouchHelperCallback(adapter, true, true,
true);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(myrecyclerview);
// Set the divider in the recyclerview
myrecyclerview.addItemDecoration(new RVHItemDividerDecoration(this, LinearLayoutManager.VERTICAL));
// Set On Click Listener
myrecyclerview.addOnItemTouchListener(new RVHItemClickListener(this, new RVHItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
String value = "Clicked Item " + data.get(position) + " at " + position;
Log.d("TAG", value);
Toast.makeText(MainActivity.this, value, Toast.LENGTH_SHORT).show();
}
}));
}
}
Demo
[Walkthrough](img/walkthrough1.gif)
Pull Requests
I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:
- Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (Reformat code) on Mac (not sure for Windows) with Android Studio defaults. This project uses a modified version of Grandcentrix's code style, so please use the same when editing this project.
- If its a feature, bugfix, or anything please only change code to what you specify.
- Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
- Pull requests must be made against
develop
branch. Any other branch (unless specified by the maintainers) will get rejected. - Check for existing issues first, before filing an issue.
- Have fun!
License
Licensed under the Apache License, Version 2.0, click here for the full license.
Author & support
This project was created by Nishant Srivastava but hopefully developed and maintained by many others. See the the list of contributors here.
Special Credits to Paul Burke and his article which got me thinking
This library contains a modified version of his implementations of ItemTouchHelper.
If you appreciate my work, consider buying me a cup of :coffee: to keep me recharged :metal: [PayPal]
*Note that all licence references and agreements mentioned in the RecyclerViewHelper README section above
are relevant to that project's source code only.