Dragger.DragHandler

public static interface Dragger.DragHandler

Interface for processing a drag behavior.

Public Method Summary

abstract Runnable
maybeGetDragGroupCreator(PendingDrag pendingDrag)
This method checks whether the pending drag maps to a valid draggable BlockGroup on the workspace.
abstract boolean
onBlockClicked(PendingDrag pendingDrag)
Handles click events on blocks.

Public Methods

public abstract Runnable maybeGetDragGroupCreator (PendingDrag pendingDrag)

This method checks whether the pending drag maps to a valid draggable BlockGroup on the workspace. If it does, it should return a Runnable that will perform (at a later time) the necessary Block and BlockView manipulations to construct that drag group, and assign it to the PendingDrag. Such manipulations must not occur immediately, because this can result in recursive touch events. The Dragger is designed to catch these calls and forcibly crash. Just don't do it.

When the Runnable is called, it should proceed with the Block and BlockView manipulations, and call startDrag(View, BlockGroup, ViewPoint) to assign the draggable BlockGroup, which must contain a root block on the Workspace and be added to the WorkspaceView.

If pending drag does not map to a draggable, this method should return null.

Parameters
pendingDrag The pending drag state in question.

public abstract boolean onBlockClicked (PendingDrag pendingDrag)

Handles click events on blocks.

Parameters
pendingDrag The pending drag state in question.
Returns
  • True if click was processed and event should be captured.