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

Commit 6e7f36c8 authored by Thales Lima's avatar Thales Lima
Browse files

add attributes for hotseat space

Hotseat now follows the size of workspace icons and should have different spaces based on the grid and posture of the device. It also has more icons.

Fixes: 204488528
Test: HSV and Window
Change-Id: I534df95dda6dc7de3f810632f2cab3822bf78416
parent 55377d3d
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -227,6 +227,13 @@
        <!-- defaults to iconTextSize, if not specified -->
        <!-- defaults to iconTextSize, if not specified -->
        <attr name="allAppsIconTextSize" format="float" />
        <attr name="allAppsIconTextSize" format="float" />


        <!-- defaults to borderSpaceDps, if not specified -->
        <attr name="hotseatBorderSpace" format="float" />
        <!-- defaults to hotseatBorderSpace, if not specified -->
        <attr name="hotseatBorderSpaceTwoPanelLandscape" format="float" />
        <!-- defaults to hotseatBorderSpace, if not specified -->
        <attr name="hotseatBorderSpaceTwoPanelPortrait" format="float" />

        <attr name="iconImageSize" format="float" />
        <attr name="iconImageSize" format="float" />
        <!-- defaults to iconImageSize, if not specified -->
        <!-- defaults to iconImageSize, if not specified -->
        <attr name="iconSizeLandscape" format="float" />
        <attr name="iconSizeLandscape" format="float" />
+7 −9
Original line number Original line Diff line number Diff line
@@ -161,6 +161,7 @@ public class DeviceProfile {
    public final int hotseatBarSidePaddingStartPx;
    public final int hotseatBarSidePaddingStartPx;
    public final int hotseatBarSidePaddingEndPx;
    public final int hotseatBarSidePaddingEndPx;
    public final int hotseatQsbHeight;
    public final int hotseatQsbHeight;
    public final int hotseatBorderSpace;


    public final float qsbBottomMarginOriginalPx;
    public final float qsbBottomMarginOriginalPx;
    public int qsbBottomMarginPx;
    public int qsbBottomMarginPx;
@@ -349,8 +350,9 @@ public class DeviceProfile {
        hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0;
        hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0;
        hotseatExtraVerticalSize =
        hotseatExtraVerticalSize =
                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size);
                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size);
        hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics);
        updateHotseatIconSize(
        updateHotseatIconSize(
                pxFromDp(inv.iconSize[InvariantDeviceProfile.INDEX_DEFAULT], mMetrics, 1f));
                pxFromDp(inv.iconSize[InvariantDeviceProfile.INDEX_DEFAULT], mMetrics));


        qsbBottomMarginOriginalPx = isScalableGrid
        qsbBottomMarginOriginalPx = isScalableGrid
                ? res.getDimensionPixelSize(R.dimen.scalable_grid_qsb_bottom_margin)
                ? res.getDimensionPixelSize(R.dimen.scalable_grid_qsb_bottom_margin)
@@ -895,14 +897,10 @@ public class DeviceProfile {
            int hotseatTopDiff = hotseatHeight - taskbarOffset;
            int hotseatTopDiff = hotseatHeight - taskbarOffset;


            int endOffset = ApiWrapper.getHotseatEndOffset(context);
            int endOffset = ApiWrapper.getHotseatEndOffset(context);
            int requiredWidth = iconSizePx * numShownHotseatIcons;
            int requiredWidth = iconSizePx * numShownHotseatIcons

                    + hotseatBorderSpace * (numShownHotseatIcons - 1);
            Resources res = context.getResources();

            float taskbarIconSize = res.getDimension(R.dimen.taskbar_icon_size);
            int hotseatSize = Math.min(requiredWidth, availableWidthPx - endOffset);
            float taskbarIconSpacing = 2 * res.getDimension(R.dimen.taskbar_icon_spacing);
            int maxSize = (int) (requiredWidth
                    * (taskbarIconSize + taskbarIconSpacing) / taskbarIconSize);
            int hotseatSize = Math.min(maxSize, availableWidthPx - endOffset);
            int sideSpacing = (availableWidthPx - hotseatSize) / 2;
            int sideSpacing = (availableWidthPx - hotseatSize) / 2;
            mHotseatPadding.set(sideSpacing, hotseatTopDiff, sideSpacing, taskbarOffset);
            mHotseatPadding.set(sideSpacing, hotseatTopDiff, sideSpacing, taskbarOffset);


+16 −0
Original line number Original line Diff line number Diff line
@@ -122,6 +122,7 @@ public class InvariantDeviceProfile {


    public PointF[] borderSpaces;
    public PointF[] borderSpaces;
    public float folderBorderSpace;
    public float folderBorderSpace;
    public float[] hotseatBorderSpaces;


    public float[] horizontalMargin;
    public float[] horizontalMargin;


@@ -331,6 +332,7 @@ public class InvariantDeviceProfile {
        numShownHotseatIcons = closestProfile.numHotseatIcons;
        numShownHotseatIcons = closestProfile.numHotseatIcons;
        numDatabaseHotseatIcons = deviceType == TYPE_MULTI_DISPLAY
        numDatabaseHotseatIcons = deviceType == TYPE_MULTI_DISPLAY
                ? closestProfile.numDatabaseHotseatIcons : closestProfile.numHotseatIcons;
                ? closestProfile.numDatabaseHotseatIcons : closestProfile.numHotseatIcons;
        hotseatBorderSpaces = displayOption.hotseatBorderSpaces;


        numAllAppsColumns = closestProfile.numAllAppsColumns;
        numAllAppsColumns = closestProfile.numAllAppsColumns;
        numDatabaseAllAppsColumns = deviceType == TYPE_MULTI_DISPLAY
        numDatabaseAllAppsColumns = deviceType == TYPE_MULTI_DISPLAY
@@ -756,6 +758,7 @@ public class InvariantDeviceProfile {
        private float folderBorderSpace;
        private float folderBorderSpace;
        private final PointF[] borderSpaces = new PointF[COUNT_SIZES];
        private final PointF[] borderSpaces = new PointF[COUNT_SIZES];
        private final float[] horizontalMargin = new float[COUNT_SIZES];
        private final float[] horizontalMargin = new float[COUNT_SIZES];
        private final float[] hotseatBorderSpaces = new float[COUNT_SIZES];


        private final float[] iconSizes = new float[COUNT_SIZES];
        private final float[] iconSizes = new float[COUNT_SIZES];
        private final float[] textSizes = new float[COUNT_SIZES];
        private final float[] textSizes = new float[COUNT_SIZES];
@@ -864,6 +867,17 @@ public class InvariantDeviceProfile {
                    R.styleable.ProfileDisplayOption_horizontalMarginTwoPanelPortrait,
                    R.styleable.ProfileDisplayOption_horizontalMarginTwoPanelPortrait,
                    horizontalMargin[INDEX_DEFAULT]);
                    horizontalMargin[INDEX_DEFAULT]);


            hotseatBorderSpaces[INDEX_DEFAULT] = a.getFloat(
                    R.styleable.ProfileDisplayOption_hotseatBorderSpace, borderSpace);
            hotseatBorderSpaces[INDEX_LANDSCAPE] = hotseatBorderSpaces[INDEX_DEFAULT];
            hotseatBorderSpaces[INDEX_ALL_APPS] = hotseatBorderSpaces[INDEX_DEFAULT];
            hotseatBorderSpaces[INDEX_TWO_PANEL_LANDSCAPE] = a.getFloat(
                    R.styleable.ProfileDisplayOption_hotseatBorderSpaceTwoPanelLandscape,
                    hotseatBorderSpaces[INDEX_DEFAULT]);
            hotseatBorderSpaces[INDEX_TWO_PANEL_PORTRAIT] = a.getFloat(
                    R.styleable.ProfileDisplayOption_hotseatBorderSpaceTwoPanelPortrait,
                    hotseatBorderSpaces[INDEX_DEFAULT]);

            a.recycle();
            a.recycle();
        }
        }


@@ -893,6 +907,7 @@ public class InvariantDeviceProfile {
                minCellSize[i].x *= w;
                minCellSize[i].x *= w;
                minCellSize[i].y *= w;
                minCellSize[i].y *= w;
                horizontalMargin[i] *= w;
                horizontalMargin[i] *= w;
                hotseatBorderSpaces[i] *= w;
            }
            }


            folderBorderSpace *= w;
            folderBorderSpace *= w;
@@ -909,6 +924,7 @@ public class InvariantDeviceProfile {
                minCellSize[i].x += p.minCellSize[i].x;
                minCellSize[i].x += p.minCellSize[i].x;
                minCellSize[i].y += p.minCellSize[i].y;
                minCellSize[i].y += p.minCellSize[i].y;
                horizontalMargin[i] += p.horizontalMargin[i];
                horizontalMargin[i] += p.horizontalMargin[i];
                hotseatBorderSpaces[i] += p.hotseatBorderSpaces[i];
            }
            }


            folderBorderSpace += p.folderBorderSpace;
            folderBorderSpace += p.folderBorderSpace;