All Projects → nisrulz → Recyclerviewhelper

nisrulz / Recyclerviewhelper

Licence: apache-2.0
📃 [Android Library] Giving powers to RecyclerView

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Recyclerviewhelper

Fullrecyclerview
This is a compilation of different kinds and actions in recyclerView
Stars: ✭ 127 (-80.25%)
Mutual labels:  swipe, recyclerview, drag, drop
Boardview
A draggable boardview for java android (Kanban style)
Stars: ✭ 309 (-51.94%)
Mutual labels:  recyclerview, drag, drop
Recyclerviewevent
RecyclerView onItemClick、onItemLongClick、drag、swipe、divider、reuse disorder RecyclerView 梳理:点击&长按事件、分割线、拖曳排序、滑动删除、优雅解决 EditText 和 CheckBox 复用错乱问题
Stars: ✭ 265 (-58.79%)
Mutual labels:  swipe, recyclerview, drag
XamarinItemTouchHelper
Basic example of using ItemTouchHelper to add drag & drop and swipe-to-dismiss to RecyclerView for Xamarin
Stars: ✭ 35 (-94.56%)
Mutual labels:  recyclerview, drag, swipe
Dragdropswiperecyclerview
Kotlin Android library that extends RecyclerView to support gestures like drag & drop and swipe, among others. It works with vertical, horizontal and grid lists.
Stars: ✭ 469 (-27.06%)
Mutual labels:  swipe, recyclerview, drag
BileTools
Tools for making garbage
Stars: ✭ 31 (-95.18%)
Mutual labels:  helper, drag, drop
yii2-forms
Forms CRUD - formbuilder, generator code
Stars: ✭ 32 (-95.02%)
Mutual labels:  drag, drop
jOrgChart
Here more functionality of jquery orgchart with json support
Stars: ✭ 29 (-95.49%)
Mutual labels:  drag, drop
image-uploader
Simple Drag & Drop image uploader plugin to static forms, without using AJAX
Stars: ✭ 70 (-89.11%)
Mutual labels:  drag, drop
Dragselectrecyclerview
TouchListener that can be attached to any RecyclerView and handles multi selection for you
Stars: ✭ 371 (-42.3%)
Mutual labels:  recyclerview, drag
navbuilder
Generiert frei definierbare Navigationsbäume mittels Drag & Drop
Stars: ✭ 21 (-96.73%)
Mutual labels:  drag, drop
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+446.19%)
Mutual labels:  swipe, recyclerview
Vue Drag And Drop
A for Vue.js directive for providing drag and drop capabilities to elements and data
Stars: ✭ 393 (-38.88%)
Mutual labels:  drag, drop
vue-simple-upload-component
A simple upload component for Vue.js 2.x
Stars: ✭ 14 (-97.82%)
Mutual labels:  drag, drop
FancyAdapters
A collection of customizable RecyclerView Adapters for Android, that provide various functionality like item selection, contextual action mode controls, drag&drop and swiping, among other.
Stars: ✭ 49 (-92.38%)
Mutual labels:  recyclerview, swipe
Vue Drag Tree
🌴🌳a Vue's drag and drop tree component || 🌾Demo
Stars: ✭ 337 (-47.59%)
Mutual labels:  drag, drop
Smooth Dnd
drag and drop library for javascript
Stars: ✭ 408 (-36.55%)
Mutual labels:  drag, drop
Android Advancedrecyclerview
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)
Stars: ✭ 5,172 (+704.35%)
Mutual labels:  swipe, recyclerview
Any Touch
👋 手势库, 按需2kb~5kb, 兼容PC / 移动端
Stars: ✭ 567 (-11.82%)
Mutual labels:  swipe, drag
rc-dock
Dock Layout for React Component
Stars: ✭ 318 (-50.54%)
Mutual labels:  drag, drop

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.

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 Download 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 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

Walkthrough

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:

  1. 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.
  2. If its a feature, bugfix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing an issue.
  6. 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 ☕️ to keep me recharged 🤘 [PayPal]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].