Further preventing drags while loading is in progress. (Bug 6276881)
Change-Id: I3fc9ad4cd3d71a8eba4e3bcc0a1b6346c59fbee5
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 8b6fee9..623313d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -496,6 +496,12 @@
return mDragLayer;
}
+ boolean isDraggingEnabled() {
+ // We prevent dragging when we are loading the workspace as it is possible to pick up a view
+ // that is subsequently removed from the workspace in startBinding().
+ return !mModel.isLoadingWorkspace();
+ }
+
static int getScreen() {
synchronized (sLock) {
return sScreen;
@@ -2077,14 +2083,9 @@
}
public boolean onLongClick(View v) {
-
- if (mState != State.WORKSPACE) {
- return false;
- }
-
- if (isWorkspaceLocked()) {
- return false;
- }
+ if (!isDraggingEnabled()) return false;
+ if (isWorkspaceLocked()) return false;
+ if (mState != State.WORKSPACE) return false;
if (!(v instanceof CellLayout)) {
v = (View) v.getParent().getParent();