From 7f78e23ccce099ea18787e9f264f0c9622e5139d Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 10 Apr 2019 14:02:38 -0700 Subject: [PATCH] Don't scale/translate hotseat icons if they are visible in overview Bug: 129145824 Change-Id: I02af7ad21b6dbc46041e774dfc6f5d3efb0ab8a9 --- .../launcher3/uioverrides/states/OverviewState.java | 12 +++++++++--- .../FlingAndHoldTouchController.java | 1 + src/com/android/launcher3/LauncherStateManager.java | 8 ++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java index 94c1545745..043fd5596f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -17,8 +17,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; -import static com.android.launcher3.logging.LoggerUtils.getTargetStr; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE; @@ -27,7 +25,6 @@ import android.view.View; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; @@ -73,6 +70,15 @@ public class OverviewState extends LauncherState { return new ScaleAndTranslation(scale, 0, -getDefaultSwipeHeight(launcher) * parallaxFactor); } + @Override + public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) { + if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { + // If the hotseat icons are visible in overview, keep them in their normal position. + return super.getWorkspaceScaleAndTranslation(launcher); + } + return getWorkspaceScaleAndTranslation(launcher); + } + @Override public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) { return new ScaleAndTranslation(1f, 0f, 0f); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java index 6dd5e21a85..bab215b864 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java @@ -111,6 +111,7 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { AnimatorSetBuilder builder = new AnimatorSetBuilder(); builder.setInterpolator(AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS, OVERSHOOT_1_2); + builder.setInterpolator(AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE, OVERSHOOT_1_2); AnimatorSet overviewAnim = mLauncher.getStateManager().createAtomicAnimation( NORMAL, OVERVIEW, builder, ANIM_ALL, ATOMIC_DURATION); overviewAnim.addListener(new AnimatorListenerAdapter() { diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 5b654d8f34..8145695c0e 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -320,8 +320,12 @@ public class LauncherStateManager { if (!isWorkspaceVisible) { workspace.setScaleX(0.92f); workspace.setScaleY(0.92f); - workspace.getHotseat().setScaleX(0.92f); - workspace.getHotseat().setScaleY(0.92f); + } + Hotseat hotseat = workspace.getHotseat(); + boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0; + if (!isHotseatVisible) { + hotseat.setScaleX(0.92f); + hotseat.setScaleY(0.92f); } } else if (fromState == NORMAL && toState == OVERVIEW_PEEK) { builder.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);