diff options
author | Tony Wickham <twickham@google.com> | 2018-04-06 14:22:46 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2018-04-06 14:32:18 -0700 |
commit | 6270a0ea18d27952fec20da04d64ca4f7e223849 (patch) | |
tree | 3c263280970b36b02981aaf4a1ec2733fb00a061 /src_ui_overrides/com/android/launcher3 | |
parent | b3ad0edc1476ae1562bb5e0b26f253b2e504285f (diff) | |
download | android_packages_apps_Trebuchet-6270a0ea18d27952fec20da04d64ca4f7e223849.tar.gz android_packages_apps_Trebuchet-6270a0ea18d27952fec20da04d64ca4f7e223849.tar.bz2 android_packages_apps_Trebuchet-6270a0ea18d27952fec20da04d64ca4f7e223849.zip |
When dragging past first or last state, don't reinit target
Example bug:
1. Swipe up to overview and let go
2. Swipe all the way to the top of the screen, past where all apps stops
3. Swipe down
Before this change, you get reset in NORMAL state instead of OVERVIEW.
By ensuring that getTargetState() checks the drag direction before
returning a new state, we guarantee we only re-init in the case that the
state is actually changing. Otherwise it's possible to change the state
to one that is impossible, such as NORMAL when swiping up from ALL APPS.
Change-Id: I19913dded9c94228d06289780b6400e99403f378
Diffstat (limited to 'src_ui_overrides/com/android/launcher3')
-rw-r--r-- | src_ui_overrides/com/android/launcher3/uioverrides/AllAppsSwipeController.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsSwipeController.java b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsSwipeController.java index c97c3ccec..d1cddc18f 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsSwipeController.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsSwipeController.java @@ -54,7 +54,12 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { @Override protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { - return fromState == ALL_APPS ? NORMAL : ALL_APPS; + if (fromState == NORMAL && isDragTowardPositive) { + return ALL_APPS; + } else if (fromState == ALL_APPS && !isDragTowardPositive) { + return NORMAL; + } + return fromState; } @Override |