summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-11-22 21:45:32 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-22 21:45:32 +0000
commit75b7b9d35cb9981ad4867d55f15d0701a2bffab4 (patch)
tree5a607dc947bb8765f4856ed566c9eea03b1e8266
parenta3ea27de3941f2802361aff1d46547122f096c7d (diff)
parent94fb4cd3fd561aa08ab1d0970687981387d7512a (diff)
downloadpackages_apps_Trebuchet-75b7b9d35cb9981ad4867d55f15d0701a2bffab4.tar.gz
packages_apps_Trebuchet-75b7b9d35cb9981ad4867d55f15d0701a2bffab4.tar.bz2
packages_apps_Trebuchet-75b7b9d35cb9981ad4867d55f15d0701a2bffab4.zip
Merge "Fix quick switch from home biased towards returning home" into ub-launcher3-qt-future-dev
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index 86aa43044..76374af6a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -342,9 +342,20 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
final LauncherState targetState;
if (horizontalFling && verticalFling) {
- // Flinging left and up, left and down, or right and up all go back home.
- // Only flinging right and down goes to quick switch.
- targetState = velocity.x < 0 || velocity.y < 0 ? NORMAL : QUICK_SWITCH;
+ if (velocity.x < 0) {
+ // Flinging left and up or down both go back home.
+ targetState = NORMAL;
+ } else {
+ if (velocity.y > 0) {
+ // Flinging right and down goes to quick switch.
+ targetState = QUICK_SWITCH;
+ } else {
+ // Flinging up and right could go either home or to quick switch.
+ // Determine the target based on the higher velocity.
+ targetState = Math.abs(velocity.x) > Math.abs(velocity.y)
+ ? QUICK_SWITCH : NORMAL;
+ }
+ }
} else if (horizontalFling) {
targetState = velocity.x > 0 ? QUICK_SWITCH : NORMAL;
} else if (verticalFling) {