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

Commit 1abb9a47 authored by Federico Baron's avatar Federico Baron Committed by Android (Google) Code Review
Browse files

Merge "Align QSB with hotseat and workspace icons" into main

parents a7519cd0 e69b6f49
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ class HotseatWidthCalculationTest : FakeInvariantDeviceProfileTest() {
        assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(580)

        assertThat(dp.isQsbInline).isFalse()
        assertThat(dp.hotseatQsbWidth).isEqualTo(1445)
        assertThat(dp.hotseatQsbWidth).isEqualTo(1435)
    }

    /**
@@ -69,7 +69,7 @@ class HotseatWidthCalculationTest : FakeInvariantDeviceProfileTest() {
        assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(550)

        assertThat(dp.isQsbInline).isFalse()
        assertThat(dp.hotseatQsbWidth).isEqualTo(1080)
        assertThat(dp.hotseatQsbWidth).isEqualTo(1070)
    }

    /**
@@ -90,7 +90,7 @@ class HotseatWidthCalculationTest : FakeInvariantDeviceProfileTest() {
        assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(759)

        assertThat(dp.isQsbInline).isFalse()
        assertThat(dp.hotseatQsbWidth).isEqualTo(1468)
        assertThat(dp.hotseatQsbWidth).isEqualTo(1455)
    }

    /**
@@ -115,7 +115,7 @@ class HotseatWidthCalculationTest : FakeInvariantDeviceProfileTest() {
        assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(1040)

        assertThat(dp.isQsbInline).isFalse()
        assertThat(dp.hotseatQsbWidth).isEqualTo(1233)
        assertThat(dp.hotseatQsbWidth).isEqualTo(1223)
    }

    /** This is a case when after setting the hotseat, the QSB width needs to be changed to fit */
+22 −12
Original line number Diff line number Diff line
@@ -789,14 +789,16 @@ public class DeviceProfile {
     * width of the hotseat.
     */
    private int calculateQsbWidth(int hotseatBorderSpace) {
        int iconExtraSpacePx = iconSizePx - getIconVisibleSizePx(iconSizePx);
        if (isQsbInline) {
            int columns = getPanelCount() * inv.numColumns;
            return getIconToIconWidthForColumns(columns)
                    - iconSizePx * numShownHotseatIcons
                    - hotseatBorderSpace * numShownHotseatIcons;
                    - hotseatBorderSpace * numShownHotseatIcons
                    - iconExtraSpacePx;
        } else {
            int columns = inv.hotseatColumnSpan[mTypeIndex];
            return getIconToIconWidthForColumns(columns);
            return getIconToIconWidthForColumns(columns) - iconExtraSpacePx;
        }
    }

@@ -1074,11 +1076,8 @@ public class DeviceProfile {
    }

    private int getNormalizedIconDrawablePadding(int iconSizePx, int iconDrawablePadding) {
        // TODO(b/235886078): workaround needed because of this bug
        // Icons are 10% larger on XML than their visual size,
        // so remove that extra space to get labels closer to the correct padding
        int iconVisibleSizePx = Math.round(ICON_VISIBLE_AREA_FACTOR * iconSizePx);
        return Math.max(0, iconDrawablePadding - ((iconSizePx - iconVisibleSizePx) / 2));
        return Math.max(0, iconDrawablePadding
                - ((iconSizePx - getIconVisibleSizePx(iconSizePx)) / 2));
    }

    private int getNormalizedIconDrawablePadding() {
@@ -1091,8 +1090,7 @@ public class DeviceProfile {
        // so remove that extra space to get labels closer to the correct padding
        int drawablePadding = (folderCellHeightPx - folderChildIconSizePx - textHeight) / 3;

        int iconVisibleSizePx = Math.round(ICON_VISIBLE_AREA_FACTOR * folderChildIconSizePx);
        int iconSizeDiff = folderChildIconSizePx - iconVisibleSizePx;
        int iconSizeDiff = folderChildIconSizePx - getIconVisibleSizePx(folderChildIconSizePx);
        return Math.max(0, drawablePadding - iconSizeDiff / 2);
    }

@@ -1788,7 +1786,8 @@ public class DeviceProfile {
            }

        } else if (mIsScalableGrid) {
            int sideSpacing = (availableWidthPx - hotseatQsbWidth) / 2;
            int iconExtraSpacePx = iconSizePx - getIconVisibleSizePx(iconSizePx);
            int sideSpacing = (availableWidthPx - (hotseatQsbWidth + iconExtraSpacePx)) / 2;
            hotseatBarPadding.set(sideSpacing,
                    0,
                    sideSpacing,
@@ -1827,13 +1826,24 @@ public class DeviceProfile {
                availableWidthPx - allAppsSpacing,
                0 /* borderSpace */,
                numShownAllAppsColumns);
        int iconVisibleSize = Math.round(ICON_VISIBLE_AREA_FACTOR * allAppsIconSizePx);
        int iconAlignmentMargin = (cellWidth - iconVisibleSize) / 2;
        int iconAlignmentMargin = (cellWidth - getIconVisibleSizePx(allAppsIconSizePx)) / 2;

        return (Utilities.isRtl(context.getResources()) ? allAppsPadding.right
                : allAppsPadding.left) + iconAlignmentMargin;
    }

    /**
     * TODO(b/235886078): workaround needed because of this bug
     * Icons are 10% larger on XML than their visual size, so remove that extra space to get
     * some dimensions correct.
     *
     * When this bug is resolved this method will no longer be needed and we would be able to
     * replace all instances where this method is called with iconSizePx.
     */
    private int getIconVisibleSizePx(int iconSizePx) {
        return Math.round(ICON_VISIBLE_AREA_FACTOR * iconSizePx);
    }

    private int getAdditionalQsbSpace() {
        return isQsbInline ? hotseatQsbWidth + hotseatBorderSpace : 0;
    }
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ DeviceProfile:
	numShownHotseatIcons: 6
	hotseatBorderSpace: 100.0px (50.0dp)
	isQsbInline: false
	hotseatQsbWidth: 1224.0px (612.0dp)
	hotseatQsbWidth: 1214.0px (607.0dp)
	isTaskbarPresent:false
	isTaskbarPresentInApps:true
	taskbarHeight: 0.0px (0.0dp)
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ DeviceProfile:
	numShownHotseatIcons: 6
	hotseatBorderSpace: 100.0px (50.0dp)
	isQsbInline: false
	hotseatQsbWidth: 1224.0px (612.0dp)
	hotseatQsbWidth: 1214.0px (607.0dp)
	isTaskbarPresent:false
	isTaskbarPresentInApps:true
	taskbarHeight: 0.0px (0.0dp)
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ DeviceProfile:
	numShownHotseatIcons: 6
	hotseatBorderSpace: 116.0px (58.0dp)
	isQsbInline: false
	hotseatQsbWidth: 1300.0px (650.0dp)
	hotseatQsbWidth: 1290.0px (645.0dp)
	isTaskbarPresent:false
	isTaskbarPresentInApps:true
	taskbarHeight: 0.0px (0.0dp)
Loading