Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 040f9e94 authored by Jordan Silva's avatar Jordan Silva Committed by Android (Google) Code Review
Browse files

Merge "Step down icon size when isVerticalBarLayout for responsive grids" into main

parents ee908965 dd612687
Loading
Loading
Loading
Loading
+19 −22
Original line number Diff line number Diff line
@@ -988,16 +988,6 @@ public class DeviceProfile {
        float workspaceCellPaddingY = getCellSize().y - iconSizePx - iconDrawablePaddingPx
                - iconTextHeight;

        if (mIsResponsiveGrid) {
            iconTextSizePx = 0;
            iconDrawablePaddingPx = 0;
            int iconSizeWithOverlap = getIconSizeWithOverlap(iconSizePx);
            cellYPaddingPx = Math.max(0, getCellSize().y - iconSizeWithOverlap) / 2;
            autoResizeAllAppsCells();

            return;
        }

        // We want enough space so that the text is closer to its corresponding icon.
        if (workspaceCellPaddingY < iconTextHeight) {
            iconTextSizePx = 0;
@@ -1115,25 +1105,28 @@ public class DeviceProfile {
                iconSizePx = mIconSizeSteps.getIconSmallerThan(cellWidthPx);
            }

            if (isVerticalLayout) {
                iconDrawablePaddingPx = 0;
                iconTextSizePx = 0;
            } else {
                iconDrawablePaddingPx = getNormalizedIconDrawablePadding();
            }

            CellContentDimensions cellContentDimensions = new CellContentDimensions(iconSizePx,
                    iconDrawablePaddingPx,
                    iconTextSizePx);
            if (isVerticalLayout) {
                if (cellHeightPx < iconSizePx) {
                    cellContentDimensions.setIconSizePx(
                            mIconSizeSteps.getIconSmallerThan(cellHeightPx));
                }
            } else {
                cellContentDimensions.resizeToFitCellHeight(cellHeightPx, mIconSizeSteps);
            }
            int cellContentHeight = cellContentDimensions.resizeToFitCellHeight(cellHeightPx,
                    mIconSizeSteps);
            iconSizePx = cellContentDimensions.getIconSizePx();
            iconDrawablePaddingPx = cellContentDimensions.getIconDrawablePaddingPx();
            iconTextSizePx = cellContentDimensions.getIconTextSizePx();
            int cellContentHeight = cellContentDimensions.getCellContentHeight();

            if (isVerticalLayout) {
                cellYPaddingPx = Math.max(0, getCellSize().y - getIconSizeWithOverlap(iconSizePx))
                        / 2;
            } else {
                cellYPaddingPx = Math.max(0, cellHeightPx - cellContentHeight) / 2;
            }
        } else if (mIsScalableGrid) {
            iconDrawablePaddingPx = (int) (getNormalizedIconDrawablePadding() * iconScale);
            cellWidthPx = pxFromDp(inv.minCellSize[mTypeIndex].x, mMetrics, scale);
@@ -1217,7 +1210,7 @@ public class DeviceProfile {
            updateAllAppsIconSize(scale, res);
        }
        updateAllAppsContainerWidth();
        if (isVerticalBarLayout()) {
        if (isVerticalLayout && !mIsResponsiveGrid) {
            hideWorkspaceLabelsIfNotEnoughSpace();
        }
        if (FeatureFlags.enableTwolineAllapps()) {
@@ -1355,6 +1348,10 @@ public class DeviceProfile {
        }

        allAppsCellHeightPx += mResponsiveAllAppsHeightSpec.getGutterPx();

        if (isVerticalBarLayout()) {
            autoResizeAllAppsCells();
        }
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -48,7 +48,10 @@ class CellContentDimensions(
            cellContentHeight = getCellContentHeight()

            // Step 3. Decrease label size
            if (cellContentHeight > cellHeightPx) {
            if (
                cellContentHeight > cellHeightPx &&
                    iconTextSizePx > iconSizeSteps.minimumIconLabelSize
            ) {
                iconTextSizePx =
                    max(
                        iconSizeSteps.minimumIconLabelSize,