epoxy-adapter / com.airbnb.epoxy / EpoxyTouchHelper

EpoxyTouchHelper

abstract class EpoxyTouchHelper

A simple way to set up drag or swipe interactions with Epoxy.

Drag events work with the EpoxyController and automatically update the controller and RecyclerView when an item is moved. You just need to implement a callback to update your data to reflect the change.

Both swipe and drag events implement a small lifecycle to help you style the views as they are moved. You can register callbacks for the lifecycle events you care about.

If you want to set up multiple drag and swipe rules for the same RecyclerView, you can use this class multiple times to specify different targets or swipe and drag directions and callbacks.

If you want more control over configuration and handling, you can opt to not use this class and instead you can implement EpoxyModelTouchCallback directly with your own . That class provides an interface that makes it easier to work with Epoxy models and simplifies touch callbacks.

If you want even more control you can implement EpoxyTouchHelperCallback. This is just a light layer over the normal RecyclerView touch callbacks, but it converts all view holders to Epoxy view holders to remove some boilerplate for you.

Types

DragBuilder

open class DragBuilder

DragBuilder2

open class DragBuilder2

DragBuilder3

open class DragBuilder3

DragBuilder4

open class DragBuilder4<U : EpoxyModel<Any!>!>

DragCallbacks

abstract class DragCallbacks<T : EpoxyModel<Any!>!> : EpoxyDragCallback<T>

SwipeBuilder

open class SwipeBuilder

SwipeBuilder2

open class SwipeBuilder2

SwipeBuilder3

open class SwipeBuilder3<U : EpoxyModel<Any!>!>

SwipeCallbacks

abstract class SwipeCallbacks<T : EpoxyModel<Any!>!> : EpoxySwipeCallback<T>

Constructors

<init>

EpoxyTouchHelper()

A simple way to set up drag or swipe interactions with Epoxy.

Functions

initDragging

open static fun initDragging(controller: EpoxyController!): EpoxyTouchHelper.DragBuilder!

The entry point for setting up drag support.

initSwiping

open static fun initSwiping(recyclerView: RecyclerView!): EpoxyTouchHelper.SwipeBuilder!

The entry point for setting up swipe support for a RecyclerView. The RecyclerView must be set with an Epoxy adapter or controller.