From 89126653cd38b6b461e893edbd3163d27a943c83 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 7 Jun 2018 20:48:04 -0700 Subject: [PATCH] Don't intercept above shelf progress if still animating When you swipe up to overview from home, we should allow touches on recents even if the overshoot animation isn't finished. If the touch is below the all apps progress, we continue to intercept to allow for double swipe up. Bug: 80093992 Change-Id: Ifdca61e7cfc1f7a713c067596cc0c1bd3154b44e --- .../PortraitStatesTouchController.java | 15 +++++++++++++-- .../touch/AbstractStateChangeTouchController.java | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java index 717179dfe0..f7554fc04c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java @@ -31,6 +31,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationComponents; +import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; @@ -68,8 +69,18 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr mCurrentAnimation.getAnimationPlayer().end(); } - // If we are already animating from a previous state, we can intercept. - return true; + AllAppsTransitionController allAppsController = mLauncher.getAllAppsController(); + if (ev.getY() >= allAppsController.getShiftRange() * allAppsController.getProgress()) { + // If we are already animating from a previous state, we can intercept as long as + // the touch is below the current all apps progress (to allow for double swipe). + return true; + } + // Otherwise, make sure everything is settled and don't intercept so they can scroll + // recents, dismiss a task, etc. + if (mAtomicAnim != null) { + mAtomicAnim.end(); + } + return false; } if (mLauncher.isInState(ALL_APPS)) { // In all-apps only listen if the container cannot scroll itself diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 898b1b7af1..aa6b680069 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -85,7 +85,7 @@ public abstract class AbstractStateChangeTouchController private boolean mCanBlockFling; private FlingBlockCheck mFlingBlockCheck = new FlingBlockCheck(); - private AnimatorSet mAtomicAnim; + protected AnimatorSet mAtomicAnim; // True if we want to resume playing atomic components when mAtomicAnim completes. private boolean mScheduleResumeAtomicComponent;