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

Commit 6057cb9f authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Update icon and text size for two panel home screen

Adding new field for landscape icon text size and changing
the logic for when to use landscape sizes.

Test: manual
Bug: 182796672
Change-Id: I89833e8fd90f2606937c3b95ac10229a042213ec
parent adfbdcf8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -162,6 +162,8 @@
        <!-- landscapeIconSize defaults to iconSize, if not specified -->
        <attr name="landscapeIconSize" format="float" />
        <attr name="iconTextSize" format="float" />
        <!-- landscapeIconTextSize defaults to iconTextSize, if not specified -->
        <attr name="landscapeIconTextSize" format="float" />
        <!-- If true, this display option is used to determine the default grid -->
        <attr name="canBeDefault" format="boolean" />

+3 −2
Original line number Diff line number Diff line
@@ -506,9 +506,10 @@ public class DeviceProfile {

        // Workspace
        final boolean isVerticalLayout = isVerticalBarLayout();
        float invIconSizeDp = isVerticalLayout ? inv.landscapeIconSize : inv.iconSize;
        float invIconSizeDp = isLandscape ? inv.landscapeIconSize : inv.iconSize;
        iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mInfo.metrics, scale));
        iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, mInfo.metrics) * scale);
        float invIconTextSizeSp = isLandscape ? inv.landscapeIconTextSize : inv.iconTextSize;
        iconTextSizePx = (int) (Utilities.pxFromSp(invIconTextSizeSp, mInfo.metrics) * scale);
        iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);

        setCellLayoutBorderSpacing((int) (cellLayoutBorderSpacingOriginalPx * scale));
+8 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ public class InvariantDeviceProfile {
    public float iconSize;
    public String iconShapePath;
    public float landscapeIconSize;
    public float landscapeIconTextSize;
    public int iconBitmapSize;
    public int fillResIconDpi;
    public float iconTextSize;
@@ -163,6 +164,7 @@ public class InvariantDeviceProfile {
        landscapeIconSize = p.landscapeIconSize;
        iconBitmapSize = p.iconBitmapSize;
        iconTextSize = p.iconTextSize;
        landscapeIconTextSize = p.landscapeIconTextSize;
        numHotseatIcons = p.numHotseatIcons;
        numAllAppsColumns = p.numAllAppsColumns;
        isScalable = p.isScalable;
@@ -293,6 +295,7 @@ public class InvariantDeviceProfile {
        landscapeIconSize = displayOption.landscapeIconSize;
        iconBitmapSize = ResourceUtils.pxFromDp(iconSize, displayInfo.metrics);
        iconTextSize = displayOption.iconTextSize;
        landscapeIconTextSize = displayOption.landscapeIconTextSize;
        fillResIconDpi = getLauncherIconDensity(iconBitmapSize);

        minCellHeight = displayOption.minCellHeight;
@@ -678,6 +681,7 @@ public class InvariantDeviceProfile {
        private float iconSize;
        private float iconTextSize;
        private float landscapeIconSize;
        private float landscapeIconTextSize;
        private float allAppsIconSize;
        private float allAppsIconTextSize;

@@ -702,6 +706,8 @@ public class InvariantDeviceProfile {
            landscapeIconSize = a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconSize,
                    iconSize);
            iconTextSize = a.getFloat(R.styleable.ProfileDisplayOption_iconTextSize, 0);
            landscapeIconTextSize = a.getFloat(
                    R.styleable.ProfileDisplayOption_landscapeIconTextSize, iconTextSize);

            allAppsIconSize = a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconSize,
                    iconSize);
@@ -731,6 +737,7 @@ public class InvariantDeviceProfile {
            landscapeIconSize *= w;
            allAppsIconSize *= w;
            iconTextSize *= w;
            landscapeIconTextSize *= w;
            allAppsIconTextSize *= w;
            minCellHeight *= w;
            minCellWidth *= w;
@@ -744,6 +751,7 @@ public class InvariantDeviceProfile {
            landscapeIconSize += p.landscapeIconSize;
            allAppsIconSize += p.allAppsIconSize;
            iconTextSize += p.iconTextSize;
            landscapeIconTextSize += p.landscapeIconTextSize;
            allAppsIconTextSize += p.allAppsIconTextSize;
            minCellHeight += p.minCellHeight;
            minCellWidth += p.minCellWidth;