From 85ac41bc7f96024eb8eff0f2cedb159c0ee52e24 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Wed, 21 May 2025 19:23:53 -0700 Subject: [PATCH] Only ignore All Apps left/right insets on tablets. This was previously the case, but I think I mistakenly updated this to include phones with the all_apps_sheet_for_handheld flag at some point. However, there was also some broken logic with the panel bounds on phones. panel.getLeft() would be 0 because that's relative to the container, so we need to do getLeft() + panel.getLeft(). Landscape (camera on left): https://hsv.googleplex.com/5035787895701504 Seascape (camera on right): https://hsv.googleplex.com/6210562886205440 Portrait: https://hsv.googleplex.com/6563945312681984 Tablet: https://hsv.googleplex.com/6704696994562048 Bug: 419235232 Test: See HSVs above compared to before images in the bug Flag: com.android.launcher3.all_apps_sheet_for_handheld Change-Id: Id8b6f3367ee94ef22cb917e00518e843553b42d8 --- .../allapps/ActivityAllAppsContainerView.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 00054591dd..4d602dd01f 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -1199,8 +1199,8 @@ public class ActivityAllAppsContainerView applyAdapterSideAndBottomPaddings(grid); MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams(); - // Ignore left/right insets on bottom sheet because we are already centered in-screen. - if (grid.shouldShowAllAppsOnSheet()) { + // Ignore left/right insets on tablet because we are already centered in-screen. + if (grid.isTablet) { mlp.leftMargin = mlp.rightMargin = 0; } else { mlp.leftMargin = insets.left; @@ -1450,13 +1450,16 @@ public class ActivityAllAppsContainerView final float horizontalScaleOffset = (1 - scale) * panel.getWidth() / 2; final float verticalScaleOffset = (1 - scale) * (panel.getHeight() - getHeight() / 2); + // Left and right insets can be applied to this container, as well as the panel. + float left = getLeft() + panel.getLeft(); + float right = left + panel.getWidth(); final float topNoScale = panel.getTop() + translationY; final float topWithScale = topNoScale + verticalScaleOffset; - final float leftWithScale = panel.getLeft() + horizontalScaleOffset; - final float rightWithScale = panel.getRight() - horizontalScaleOffset; + final float leftWithScale = left + horizontalScaleOffset; + final float rightWithScale = right - horizontalScaleOffset; final float bottomWithOffset = panel.getBottom() + bottomOffsetPx; - // Draw full background panel for tablets. + // Draw full background panel if presenting on a sheet. int bottomSheetBackgroundColor = getBottomSheetBackgroundColor(); float bottomSheetBackgroundAlpha = Color.alpha(bottomSheetBackgroundColor) / 255.0f; if (hasBottomSheet) { @@ -1535,11 +1538,11 @@ public class ActivityAllAppsContainerView } mHeaderPaint.setAlpha((int) tabAlpha); } - float left = 0f; - float right = canvas.getWidth(); + left = 0f; + right = canvas.getWidth(); if (hasBottomSheet) { - left = mBottomSheetBackground.getLeft() + horizontalScaleOffset; - right = mBottomSheetBackground.getRight() - horizontalScaleOffset; + left = leftWithScale; + right = rightWithScale; } final float tabTopWithScale = hasBottomSheet