Merge "Scale using workspace width for handheld device on swiping from home to overview." into tm-qpr-dev am: 105d72b6ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21958125
Change-Id: I86a3c8d0cfb6b258031669d8fb9e6b15a1fb2733
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index d2f9294..214679a 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 @@
@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);
}