diff options
Diffstat (limited to 'src/com/android/launcher3/dragndrop/DragOptions.java')
-rw-r--r-- | src/com/android/launcher3/dragndrop/DragOptions.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragOptions.java b/src/com/android/launcher3/dragndrop/DragOptions.java index 3d52a48c6..dbf46f338 100644 --- a/src/com/android/launcher3/dragndrop/DragOptions.java +++ b/src/com/android/launcher3/dragndrop/DragOptions.java @@ -28,4 +28,44 @@ public class DragOptions { /** Specifies the start location for the system DnD, null when using internal DnD */ public Point systemDndStartPoint = null; + + /** Determines when a deferred drag should start. By default, drags aren't deferred at all. */ + public DeferDragCondition deferDragCondition = new DeferDragCondition(); + + /** + * Specifies a condition that must be met before DragListener#onDragStart() is called. + * By default, there is no condition and onDragStart() is called immediately following + * DragController#startDrag(). + * + * This condition can be overridden, and callbacks are provided for the following cases: + * - The drag starts, but onDragStart() is deferred (onDeferredDragStart()). + * - The drag ends before the condition is met (onDropBeforeDeferredDrag()). + * - The condition is met (onDragStart()). + */ + public static class DeferDragCondition { + public boolean shouldStartDeferredDrag(double distanceDragged) { + return true; + } + + /** + * The drag has started, but onDragStart() is deferred. + * This happens when shouldStartDeferredDrag() returns true. + */ + public void onDeferredDragStart() { + // Do nothing. + } + + /** + * User dropped before the deferred condition was met, + * i.e. before shouldStartDeferredDrag() returned true. + */ + public void onDropBeforeDeferredDrag() { + // Do nothing + } + + /** onDragStart() has been called, now we are in a normal drag. */ + public void onDragStart() { + // Do nothing + } + } } |