DpadDragHelper
class DpadDragHelper<T>(adapter: DpadDragHelper.DragAdapter<T>, callback: DpadDragHelper.DragCallback, stopKeyCodes: Set<Int> = setOf(
KeyEvent.KEYCODE_DPAD_CENTER,
KeyEvent.KEYCODE_ENTER,
))
A helper class for re-ordering the contents of a DpadRecyclerView.
To use this, your adapter needs to implement DpadDragHelper.DragAdapter and expose the mutable collection via DpadDragHelper.DragAdapter.getMutableItems.
Parameters
adapter
the adapter that backs the data that can be arranged
callback
the callback for notifying dragging state changes
stopKeyCodes
key codes that will be accepted to stop the dragging state
Constructors
Link copied to clipboard
constructor(adapter: DpadDragHelper.DragAdapter<T>, callback: DpadDragHelper.DragCallback, stopKeyCodes: Set<Int> = setOf(
KeyEvent.KEYCODE_DPAD_CENTER,
KeyEvent.KEYCODE_ENTER,
))
Types
Properties
Link copied to clipboard
True if the attached DpadRecyclerView is currently in drag mode, false otherwise
Functions
Link copied to clipboard
Attaches the DpadRecyclerView that will be dragged. This is required before calling startDrag
Link copied to clipboard
Detaches the previously attached DpadRecyclerView and stops dragging
Link copied to clipboard
Cancels the current ongoing dragging action DragCallback.onDragStopped will be called after this method