Merge "Only ignore All Apps left/right insets on tablets." into main

This commit is contained in:
Andy Wickham authored and Android (Google) Code Review committed 2025-05-23 12:53:58 -07:00
commit bdbf8a9935
1 file changed
+12 -9
@@ -1210,8 +1210,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;
@@ -1461,13 +1461,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) {
@@ -1546,11 +1549,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