EpoxyModelTouchCallback

A wrapper around androidx.recyclerview.widget.ItemTouchHelper.Callback to enable easier touch support when working with Epoxy models.

For simplicity you can use EpoxyTouchHelper to set up touch handling via this class for you instead of using this class directly. However, you may choose to use this class directly with your own ItemTouchHelper if you need extra flexibility or customization.

Constructors

EpoxyModelTouchCallback
Link copied to clipboard
open fun EpoxyModelTouchCallback(@Nullable() controller: EpoxyController, targetModelClass: Class<T>)

Functions

canDropOver
Link copied to clipboard
open fun canDropOver(recyclerView: RecyclerView, current: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean
fun canDropOver(recyclerView: RecyclerView, current: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean
chooseDropTarget
Link copied to clipboard
open fun chooseDropTarget(selected: RecyclerView.ViewHolder, dropTargets: List<RecyclerView.ViewHolder>, curX: Int, curY: Int): RecyclerView.ViewHolder
fun chooseDropTarget(selected: RecyclerView.ViewHolder, dropTargets: List, curX: Int, curY: Int): RecyclerView.ViewHolder
clearView
Link copied to clipboard
open fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder)
fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder)
open fun clearView(model: T, itemView: View)
Called when the user interaction with a view is over and the view hascompleted its animation.
convertToAbsoluteDirection
Link copied to clipboard
open fun convertToAbsoluteDirection(flags: Int, layoutDirection: Int): Int
convertToRelativeDirection
Link copied to clipboard
open fun convertToRelativeDirection(flags: Int, layoutDirection: Int): Int
getAnimationDuration
Link copied to clipboard
open fun getAnimationDuration(recyclerView: RecyclerView, animationType: Int, animateDx: Float, animateDy: Float): Long
getBoundingBoxMargin
Link copied to clipboard
open fun getBoundingBoxMargin(): Int
getDefaultUIUtil
Link copied to clipboard
open fun getDefaultUIUtil(): ItemTouchUIUtil
getMovementFlags
Link copied to clipboard
abstract fun getMovementFlags(p: RecyclerView, p1: RecyclerView.ViewHolder): Int
fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int
getMovementFlagsForModel
Link copied to clipboard
abstract fun getMovementFlagsForModel(model: T, adapterPosition: Int): Int
Should return a composite flag which defines the enabled move directions in each state(idle, swiping, dragging) for the given model.
getMoveThreshold
Link copied to clipboard
open fun getMoveThreshold(viewHolder: RecyclerView.ViewHolder): Float
fun getMoveThreshold(viewHolder: RecyclerView.ViewHolder): Float
getSwipeEscapeVelocity
Link copied to clipboard
open fun getSwipeEscapeVelocity(defaultValue: Float): Float
getSwipeThreshold
Link copied to clipboard
open fun getSwipeThreshold(viewHolder: RecyclerView.ViewHolder): Float
fun getSwipeThreshold(viewHolder: RecyclerView.ViewHolder): Float
getSwipeVelocityThreshold
Link copied to clipboard
open fun getSwipeVelocityThreshold(defaultValue: Float): Float
interpolateOutOfBoundsScroll
Link copied to clipboard
open fun interpolateOutOfBoundsScroll(recyclerView: RecyclerView, viewSize: Int, viewSizeOutOfBounds: Int, totalSize: Int, msSinceStartScroll: Long): Int
isItemViewSwipeEnabled
Link copied to clipboard
open fun isItemViewSwipeEnabled(): Boolean
isLongPressDragEnabled
Link copied to clipboard
open fun isLongPressDragEnabled(): Boolean
makeFlag
Link copied to clipboard
open fun makeFlag(actionState: Int, directions: Int): Int
makeMovementFlags
Link copied to clipboard
open fun makeMovementFlags(dragFlags: Int, swipeFlags: Int): Int
onChildDraw
Link copied to clipboard
open fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean)
fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean)
onChildDrawOver
Link copied to clipboard
open fun onChildDrawOver(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean)
fun onChildDrawOver(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean)
onDragReleased
Link copied to clipboard
open fun onDragReleased(model: T, itemView: View)
Called after onDragStarted when the view being dragged isreleased.
onDragStarted
Link copied to clipboard
open fun onDragStarted(model: T, itemView: View, adapterPosition: Int)
Called when the view switches from an idle state to a dragged state, as the user begins a draginteraction with it.
onModelMoved
Link copied to clipboard
open fun onModelMoved(fromPosition: Int, toPosition: Int, modelBeingMoved: T, itemView: View)
Called after onDragStarted when the dragged view is dropped toa new position.
onMove
Link copied to clipboard
abstract fun onMove(p: RecyclerView, p1: RecyclerView.ViewHolder, p2: RecyclerView.ViewHolder): Boolean
fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean
onMoved
Link copied to clipboard
open fun onMoved(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, fromPos: Int, target: RecyclerView.ViewHolder, toPos: Int, x: Int, y: Int)
fun onMoved(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, fromPos: Int, target: RecyclerView.ViewHolder, toPos: Int, x: Int, y: Int)
onSelectedChanged
Link copied to clipboard
open fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder, actionState: Int)
fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder, actionState: Int)
onSwipeCompleted
Link copied to clipboard
open fun onSwipeCompleted(model: T, itemView: View, position: Int, direction: Int)
Called after onSwipeReleased if the swipe surpassed the threshold tobe considered a full swipe.
onSwiped
Link copied to clipboard
abstract fun onSwiped(p: RecyclerView.ViewHolder, p1: Int)
fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int)
onSwipeProgressChanged
Link copied to clipboard
open fun onSwipeProgressChanged(model: T, itemView: View, swipeProgress: Float, canvas: Canvas)
Once a view has begun swiping with onSwipeStarted it willreceive this callback as the swipe distance changes.
onSwipeReleased
Link copied to clipboard
open fun onSwipeReleased(model: T, itemView: View)
Called when the user has released their touch on the view.
onSwipeStarted
Link copied to clipboard
open fun onSwipeStarted(model: T, itemView: View, adapterPosition: Int)
Called when the view switches from an idle state to a swiped state, as the user begins a swipeinteraction with it.