diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java index 3a2958d54e..ebae1cd968 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java @@ -42,6 +42,7 @@ import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchCon import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController; import com.android.launcher3.uioverrides.touchcontrollers.QuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController; +import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; import com.android.launcher3.util.TouchController; import com.android.launcher3.util.UiThreadHelper; import com.android.launcher3.util.UiThreadHelper.AsyncCommand; @@ -148,6 +149,9 @@ public abstract class RecentsUiFactory { if (launcher.getDeviceProfile().isVerticalBarLayout()) { list.add(new OverviewToAllAppsTouchController(launcher)); list.add(new LandscapeEdgeSwipeController(launcher)); + if (mode.hasGestures) { + list.add(new TransposedQuickSwitchTouchController(launcher)); + } } else { list.add(new PortraitStatesTouchController(launcher, mode.hasGestures /* allowDragToOverview */)); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java index 82ab34ba2c..73f328bc1d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java @@ -24,6 +24,7 @@ import android.view.MotionEvent; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; +import com.android.launcher3.Utilities; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; @@ -52,7 +53,7 @@ public class OverviewToAllAppsTouchController extends PortraitStatesTouchControl // In all-apps only listen if the container cannot scroll itself return mLauncher.getAppsView().shouldContainerScroll(ev); } else if (mLauncher.isInState(NORMAL)) { - return true; + return (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0; } else if (mLauncher.isInState(OVERVIEW)) { RecentsView rv = mLauncher.getOverviewPanel(); return ev.getY() > (rv.getBottom() - rv.getPaddingBottom()); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index a1a790c2b6..e1dd124a9d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -57,7 +57,11 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll private @Nullable TaskView mTaskToLaunch; public QuickSwitchTouchController(Launcher launcher) { - super(launcher, SwipeDetector.HORIZONTAL); + this(launcher, SwipeDetector.HORIZONTAL); + } + + protected QuickSwitchTouchController(Launcher l, SwipeDetector.Direction dir) { + super(l, dir); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java new file mode 100644 index 0000000000..f1e4041eb2 --- /dev/null +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.uioverrides.touchcontrollers; + +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherState; +import com.android.launcher3.touch.SwipeDetector; + +public class TransposedQuickSwitchTouchController extends QuickSwitchTouchController { + + public TransposedQuickSwitchTouchController(Launcher launcher) { + super(launcher, SwipeDetector.VERTICAL); + } + + @Override + protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { + return super.getTargetState(fromState, + isDragTowardPositive ^ mLauncher.getDeviceProfile().isSeascape()); + } + + @Override + protected float initCurrentAnimation(int animComponents) { + float multiplier = super.initCurrentAnimation(animComponents); + return mLauncher.getDeviceProfile().isSeascape() ? multiplier : -multiplier; + } + + @Override + protected float getShiftRange() { + return mLauncher.getDeviceProfile().heightPx / 2f; + } +}