Cleaning up drag state management.

When the drag is started, the UI automatically goes into spring loaded mode. On a successful
drop, it is the responsibility of the {@link DropTarget} to exit out of the spring loaded
mode. If the drop was cancelled for some reason, the UI will automatically exit out of this mode.

Bug: 34692289
Change-Id: Ic611739a43bb8d9279b587aaee3039326c143e8b
This commit is contained in:
Sunny Goyal
2017-10-06 13:29:57 -07:00
parent cbdfc598fa
commit 1797af41d1
16 changed files with 111 additions and 194 deletions

View File

@@ -59,9 +59,6 @@ public interface DropTarget {
/** The object is part of an accessible drag operation */
public boolean accessibleDrag;
/** Post drag animation runnable */
public Runnable postAnimationRunnable = null;
/** Indicates that the drag operation was cancelled */
public boolean cancelled = false;
@@ -105,7 +102,14 @@ public interface DropTarget {
boolean isDropEnabled();
/**
* Handle an object being dropped on the DropTarget
* Handle an object being dropped on the DropTarget.
*
* This will be called only if this target previously returned true for {@link #acceptDrop}. It
* is the responsibility of this target to exit out of the spring loaded mode (either
* immediately or after any pending animations).
*
* If the drop was cancelled for some reason, onDrop will never get called, the UI will
* automatically exit out of this mode.
*/
void onDrop(DragObject dragObject, DragOptions options);