30

GitHub - bufferapp/MultiActionSwipeHelper: An Android RecyclerView Swipe Helper...

 5 years ago
source link: https://github.com/bufferapp/MultiActionSwipeHelper
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

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

demo

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 instances - these all provide information around the details for the display of the action (label, icon, color etc)

val swipeActions = listOf<SwipeAction>()

Next you need to create an instance of the SwipeToPerformActionCallback 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 class and attach it to your recycler view:

SwipePositionItemTouchHelper(swipeHandler).attachToRecyclerView(recycler_conversations)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK