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
This commit is contained in:
Andy Wickham
2025-05-21 19:23:53 -07:00
parent 6d532fe59d
commit 85ac41bc7f
@@ -1199,8 +1199,8 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
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<T extends Context & ActivityContext>
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<T extends Context & ActivityContext>
}
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