nisrulz/recyclerviewhelper is a mobile-focused project on GitHub with 629 stars, written primarily in Java. :page_with_curl: [Android Library] Giving powers to RecyclerView
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
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.
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
where {latest version} corresponds to published version in without the prepended x.
This is done to distinguish between library using andoirdx vs pre-androidx.
Implement the RHVAdapter in your recycler view adapter and RHVViewHolder in your ItemViewHolder
public 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
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
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]
Does nisrulz/recyclerviewhelper have a project website?
No homepage URL was recorded for nisrulz/recyclerviewhelper in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is nisrulz/recyclerviewhelper open source?
Yes — nisrulz/recyclerviewhelper ships under the Apache-2.0 license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/nisrulz/recyclerviewhelper.
What else is in the Mobile space?
nisrulz/recyclerviewhelper is tracked by TopGit under the Mobile category, alongside 8 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is nisrulz/recyclerviewhelper?
nisrulz/recyclerviewhelper (nisrulz/recyclerviewhelper) is a Java project on GitHub. From the project's own README: :page_with_curl: [Android Library] Giving powers to RecyclerView
What license does nisrulz/recyclerviewhelper use?
nisrulz/recyclerviewhelper is released under the Apache-2.0 license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about nisrulz/recyclerviewhelper?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/nisrulz/recyclerviewhelper is the definitive source.
Why is nisrulz/recyclerviewhelper categorized under Mobile?
TopGit places nisrulz/recyclerviewhelper in the Mobile category based on its GitHub topics and description (tagged: "android", "android-library", "divide"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Want a second opinion on recyclerviewhelper?
Ask an AI that can read this page — one click and you get its take on recyclerviewhelper.