LongPressDragObserver

interface LongPressDragObserver
androidx.ui.core.gesture.LongPressDragObserver

Summary

Public methods

open PxPosition
onDrag(dragDistance: PxPosition)

Override to be notified when a distance has been dragged.

open Unit

Override to be notified when dragging has actually begun.

open Unit
onLongPress(pxPosition: PxPosition)

Override to be notified when a long press has occurred and thus dragging can start.

open Unit
onStop(velocity: PxPosition)

Override to be notified when a drag has stopped.

Public methods

onDrag

open fun onDrag(dragDistance: PxPosition): PxPosition

Override to be notified when a distance has been dragged.

When overridden, return the amount of the dragDistance that has been consumed.

Called after onDragStart and for every subsequent pointer movement, as long as the movement was enough to constitute a drag (the average movement on the x or y axis is not equal to 0). This may be called synchronously, immediately afterward onDragStart, as a result of the same pointer input event.

Note: This will be called multiple times for a single pointer input event and the values provided in each call should be considered unique.

Parameters
dragDistance: PxPosition The distance that has been dragged. Reflects the average drag distance of all pointers.

onDragStart

open fun onDragStart(): Unit

Override to be notified when dragging has actually begun.

Dragging has begun when both onLongPress has been called, and the average pointer distance change is not 0.

This will not be called until after onLongPress has been called, and may be called synchronously, immediately afterward onLongPress, as a result of the same pointer input event.

This will not be called again until onStop has been called.

onLongPress

open fun onLongPress(pxPosition: PxPosition): Unit

Override to be notified when a long press has occurred and thus dragging can start.

Note that when this is called, dragging hasn't actually started, but rather, dragging can start. When dragging has actually started, onDragStart will be called. It is possible for onDragStart to be called immediately after this synchronously in the same event stream.

This won't be called again until after onStop has been called.

onStop

open fun onStop(velocity: PxPosition): Unit

Override to be notified when a drag has stopped.

This is called once all pointers have stopped interacting with this DragGestureDetector and onLongPress was previously called.