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:
1 parent
cbdfc598fa
commit
1797af41d1
16 files changed
+111
-194
No files matched your search
@@ -97,9 +97,7 @@ public class UninstallDropTarget extends ButtonDropTarget {
|
||||
@Override
|
||||
public void onDrop(DragObject d, DragOptions options) {
|
||||
// Defer onComplete
|
||||
if (options.deferCompleteForUninstall) {
|
||||
d.dragSource = new DeferredOnComplete(d.dragSource, getContext());
|
||||
}
|
||||
d.dragSource = new DeferredOnComplete(d.dragSource, getContext());
|
||||
super.onDrop(d, options);
|
||||
}
|
||||
|
||||
@@ -171,7 +169,7 @@ public class UninstallDropTarget extends ButtonDropTarget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDropCompleted(View target, DragObject d, boolean isFlingToDelete,
|
||||
public void onDropCompleted(View target, DragObject d,
|
||||
boolean success) {
|
||||
mDragObject = d;
|
||||
}
|
||||
@@ -189,7 +187,7 @@ public class UninstallDropTarget extends ButtonDropTarget {
|
||||
.getApplicationInfo(mPackageName, PackageManager.MATCH_UNINSTALLED_PACKAGES,
|
||||
mDragObject.dragInfo.user) == null) {
|
||||
mDragObject.dragSource = mOriginal;
|
||||
mOriginal.onDropCompleted(UninstallDropTarget.this, mDragObject, false, true);
|
||||
mOriginal.onDropCompleted(UninstallDropTarget.this, mDragObject, true);
|
||||
} else {
|
||||
sendFailure();
|
||||
}
|
||||
@@ -198,7 +196,7 @@ public class UninstallDropTarget extends ButtonDropTarget {
|
||||
public void sendFailure() {
|
||||
mDragObject.dragSource = mOriginal;
|
||||
mDragObject.cancelled = true;
|
||||
mOriginal.onDropCompleted(UninstallDropTarget.this, mDragObject, false, false);
|
||||
mOriginal.onDropCompleted(UninstallDropTarget.this, mDragObject, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user