Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

OnDragInitiatedListener

interface OnDragInitiatedListener
androidx.recyclerview.selection.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 View#startDragAndDrop(ClipData, View.DragShadowBuilder, Object, int) for details.

Summary

Public methods
abstract Boolean

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

Public methods

onDragInitiated

abstract fun onDragInitiated(@NonNull 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 SelectionTracker#copySelection(MutableSelection). If there is no selection get the item under the event using ItemDetailsLookup#getItemDetails(MotionEvent).

Drag region used with pointer devices is specified by ItemDetails#inDragRegion(MotionEvent)

See android.view.View#startDragAndDrop(ClipData, View.DragShadowBuilder, Object, int) for details on drag and drop implementation.

Parameters
e MotionEvent: the event associated with the drag.
Return
Boolean true if drag and drop was initiated.