From 0c7852f822497a2189bb6fb778cc14ea776f6fe6 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 2 Dec 2016 14:47:04 -0800 Subject: [PATCH] Allow long-press on workspace immediately after dropping. Previously the touch was consumed until the transition from spring-loaded to normal workspace finished, leading long presses to trigger on the background rather than on apps. This made it difficult to move multiple icons consecutively. Bug: 29631912 Change-Id: I259e618c81f56bc40d08a5d63ddbbf3c82a76baf --- src/com/android/launcher3/Hotseat.java | 2 +- src/com/android/launcher3/Workspace.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 5c96dde43d..eecbe349fa 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -168,7 +168,7 @@ public class Hotseat extends FrameLayout public boolean onInterceptTouchEvent(MotionEvent ev) { // We don't want any clicks to go through to the hotseat unless the workspace is in // the normal state or an accessible drag is in progress. - return mLauncher.getWorkspace().workspaceInModalState() && + return !mLauncher.getWorkspace().workspaceIconsCanBeDragged() && !mLauncher.getAccessibilityDelegate().isInAccessibleDrag(); } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 10680b4e0d..00e458f6a8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1160,7 +1160,7 @@ public class Workspace extends PagedView } private boolean shouldConsumeTouch(View v) { - return (workspaceInModalState() || !isFinishedSwitchingState()) + return !workspaceIconsCanBeDragged() || (!workspaceInModalState() && indexOfChild(v) != mCurrentPage); } @@ -1826,6 +1826,11 @@ public class Workspace extends PagedView return mState != State.NORMAL; } + /** Returns whether a drag should be allowed to be started from the current workspace state. */ + public boolean workspaceIconsCanBeDragged() { + return mState == State.NORMAL || mState == State.SPRING_LOADED; + } + @Thunk void updateChildrenLayersEnabled(boolean force) { boolean small = mState == State.OVERVIEW || mIsSwitchingState; boolean enableChildrenLayers = force || small || mAnimatingViewIntoPlace || isPageInTransition();