From 616b46ef2ecddcbc85584bfeb786b370d696d88f Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Fri, 10 Mar 2023 15:35:15 +0000 Subject: [PATCH] Scale using workspace width for handheld device on swiping from home to overview. Continue to use height to compute scale for two panel home. Fix: 272735870 Test: manual. Swipe from home to overview. Change-Id: If7da8c504c389eab3ca337a69eb60dfe28467ed2 --- .../launcher3/uioverrides/states/OverviewState.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index d2f9294c5b..214679acbe 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -75,9 +75,17 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); - float workspacePageHeight = launcher.getDeviceProfile().getCellLayoutHeight(); recentsView.getTaskSize(sTempRect); - float scale = (float) sTempRect.height() / workspacePageHeight; + float scale; + DeviceProfile deviceProfile = launcher.getDeviceProfile(); + if (deviceProfile.isTwoPanels) { + // In two panel layout, width does not include both panels or space between them, so + // use height instead. We do not use height for handheld, as cell layout can be + // shorter than a task and we want the workspace to scale down to task size. + scale = (float) sTempRect.height() / deviceProfile.getCellLayoutHeight(); + } else { + scale = (float) sTempRect.width() / deviceProfile.getCellLayoutWidth(); + } float parallaxFactor = 0.5f; return new ScaleAndTranslation(scale, 0, -getDefaultSwipeHeight(launcher) * parallaxFactor); }