OnDragInitiatedListener


interface OnDragInitiatedListener


Register an OnDragInitiatedListener to be notified when user intent to perform drag and drop operations on an item or items has been detected. Handle these events using View support for Drag and drop.

See startDragAndDrop for details.

Summary

Public functions

Boolean

Called when user intent to perform a drag and drop operation has been detected.

Public functions

onDragInitiated

Added in 1.0.0
fun onDragInitiated(e: MotionEvent): Boolean

Called when user intent to perform a drag and drop operation has been detected.

The following circumstances are considered to be expressing drag and drop intent:

  1. Long press on selected item.
  2. Click and drag in the drag region of selected item with a pointer device.
  3. Click and drag in drag region of un-selected item with a pointer device.

The RecyclerView item at the coordinates of the MotionEvent is not supplied as a parameter to this method as there may be multiple items selected or no items selected (as may be the case in pointer drive drag and drop.)

Obtain the current list of selected items from copySelection. If there is no selection get the item under the event using getItemDetails.

Drag region used with pointer devices is specified by inDragRegion

See startDragAndDrop for details on drag and drop implementation.

Parameters
e: MotionEvent

the event associated with the drag.

Returns
Boolean

true if drag and drop was initiated.