https://github.com/bufferapp/multiactionswipehelper
An Android RecyclerView Swipe Helper for handling multiple actions per direction
https://github.com/bufferapp/multiactionswipehelper
Last synced: 11 months ago
JSON representation
An Android RecyclerView Swipe Helper for handling multiple actions per direction
- Host: GitHub
- URL: https://github.com/bufferapp/multiactionswipehelper
- Owner: bufferapp
- Created: 2018-10-31T14:53:46.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2020-06-22T16:01:17.000Z (over 5 years ago)
- Last Synced: 2025-02-09T05:51:29.348Z (12 months ago)
- Language: Java
- Size: 3.73 MB
- Stars: 295
- Watchers: 9
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MultiActionSwipeHelper
An Android RecyclerView Swipe Helper for handling multiple actions per direction. The helper allows you to have 4 items in total:
- Short left swipe
- Long left swipe
- Short right swipe
- Long right swipe

Sample app coming soon!
# Usage
The setup is fairly straightforward and requires little code. To begin with, you need to create a list of [SwipeAction](https://github.com/bufferapp/MultiActionSwipeHelper/blob/master/app/src/main/java/org/buffer/android/multiactionswipehelper/SwipeAction.kt) instances - these all provide information around the details for the display of the action (label, icon, color etc)
val swipeActions = listOf()
Next you need to create an instance of the [SwipeToPerformActionCallback](https://github.com/bufferapp/MultiActionSwipeHelper/blob/master/app/src/main/java/org/buffer/android/multiactionswipehelper/SwipeToPerformActionCallback.kt) class, this handles the magic around the display of the current action, as well as passing back which action should be performed when an item is swiped.
val swipeHandler = SwipeToPerformActionCallback(swipeListener, some_margin_value, it)
Finally, create an instance of the [SwipePositionItemTouchHelper](https://github.com/bufferapp/MultiActionSwipeHelper/blob/master/app/src/main/java/org/buffer/android/multiactionswipehelper/SwipePositionItemTouchHelper.java) class and attach it to your recycler view:
SwipePositionItemTouchHelper(swipeHandler).attachToRecyclerView(recycler_conversations)