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

Commit cb66f322 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Fix tablet/phone hotseat padding

parent 26483f8f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@
    <dimen name="hotseat_bar_bottom_space_default">48</dimen>
    <dimen name="hotseat_bar_top_space_default">42</dimen>
    <dimen name="hotseat_bar_top_space_default_three_button">24</dimen>
    <dimen name="hotseat_bar_bottom_space_default_three_button">64</dimen>
    <dimen name="hotseat_bar_bottom_space_default_taskbar">12</dimen>
    <dimen name="hotseat_qsb_space_default">0</dimen>

    <!-- Whether to enable background preloading of task thumbnails. -->
+0 −2
Original line number Diff line number Diff line
@@ -310,8 +310,6 @@
            launcher:allAppsBorderSpaceHorizontal="8"
            launcher:allAppsBorderSpaceVertical="16"
            launcher:allAppsBorderSpaceLandscape="16"
            launcher:hotseatBarBottomSpace="16"
            launcher:hotseatBarBottomSpaceLandscape="10"
            launcher:startAlignTaskbar="true"
            launcher:startAlignTaskbarLandscape="true"
            launcher:canBeDefault="true" />
+16 −17
Original line number Diff line number Diff line
@@ -2069,7 +2069,6 @@ public class DeviceProfile {
                hotseatBarPadding.left = startSpacing;
                hotseatBarPadding.right = endSpacing;
            }

        } else if (mIsScalableGrid) {
            int iconExtraSpacePx = iconSizePx - getIconVisibleSizePx(iconSizePx);
            int sideSpacing = (availableWidthPx - (hotseatQsbWidth + iconExtraSpacePx)) / 2;
@@ -2091,7 +2090,7 @@ public class DeviceProfile {
            hotseatBarPadding.set(
                    hotseatAdjustment + workspacePadding.left + cellLayoutPaddingPx.left
                            + mInsets.left,
                    isNoHintGesture ? (hotseatBarSizePx - hotseatCellHeightPx) / 2 : 0,
                    getHotseatBarTopPadding(),
                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingPx.right
                            + mInsets.right,
                    isNoHintGesture ? getHotseatBarBottomPadding() - (getHotseatBarBottomPadding() / 2)
@@ -2165,27 +2164,30 @@ public class DeviceProfile {
     * Returns the number of pixels the hotseat is translated from the bottom of the screen.
     */
    private int getHotseatBarBottomPadding() {
        WindowManagerProxy wm = WindowManagerProxy.INSTANCE.get(context);
        boolean isFullyGesture = wm.getNavigationMode(context) == NavigationMode.NO_BUTTON;
        int heightDifference = Math.abs(hotseatCellHeightPx - iconSizePx);
        int taskbarOffset = (int) ResourcesCompat.getFloat(
                context.getResources(),
                R.dimen.hotseat_bar_bottom_space_default_taskbar
        );
        if (isTaskbarPresent) { // QSB on top or inline
            if (isGestural()) {
                if (isLandscape) {
                    return -1;
                return taskbarOffset;
            } else {
                    return heightDifference / 5;
                if (isTablet) {
                    heightDifference += taskbarOffset;
                }
            } else {
                return hotseatBarBottomSpacePx - heightDifference;
            }
        } else {
            if (isNoHintGesture) {
                return (int) (Math.abs(hotseatBarSizePx - iconSizePx) / 2.2f);
                return Math.abs(hotseatBarSizePx - iconSizePx);
            }
            return hotseatBarBottomSpacePx + (int) ((isGestural() ? .75f : 2f)
                    * heightDifference);
            if (!isGestural()) {
                heightDifference += taskbarOffset;
            }

            return hotseatBarBottomSpacePx + heightDifference;
        }
    }

    /**
@@ -2193,6 +2195,7 @@ public class DeviceProfile {
     */
    private int getHotseatBarTopPadding() {
        float topPadding = 0;

        if (isPhone) {
            WindowManagerProxy wm = WindowManagerProxy.INSTANCE.get(context);
            boolean isThreeButtonNav = wm.getNavigationMode(context) == NavigationMode.THREE_BUTTONS;
@@ -2351,10 +2354,6 @@ public class DeviceProfile {
        return wm.getNavigationMode(context) == NavigationMode.NO_BUTTON;
    }

    public static boolean isGestural(Context context) {
        return DisplayController.getNavigationMode(context).equals(NavigationMode.NO_BUTTON);
    }

    private String pxToDpStr(String name, float value) {
        return "\t" + name + ": " + value + "px (" + dpiFromPx(value, mMetrics.densityDpi) + "dp)";
    }
+14 −3
Original line number Diff line number Diff line
@@ -1469,13 +1469,24 @@ public class InvariantDeviceProfile {
                    horizontalMargin[INDEX_DEFAULT]);

            WindowManagerProxy wm = WindowManagerProxy.INSTANCE.get(context);
            boolean noHintGesture = wm.getNavigationMode(context) == NavigationMode.NO_BUTTON && LineageSettings.System.getInt(
            boolean isGesture = wm.getNavigationMode(context) == NavigationMode.NO_BUTTON;
            boolean noHintGesture = isGesture && LineageSettings.System.getInt(
                    context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;
            float hotseatBarBottom = ResourcesCompat.getFloat(res, R.dimen.hotseat_qsb_space_default);
            boolean isTablet = grid.deviceCategory == TYPE_TABLET;
            if (isTablet && isGesture) {
                hotseatBarBottom = ResourcesCompat.getFloat(res, R.dimen.hotseat_bar_top_space_default_three_button);
            } else if (noHintGesture || !isTablet) {
                hotseatBarBottom = ResourcesCompat.getFloat(res, R.dimen.hotseat_bar_bottom_space_default);
            }

            if (!isGesture && !isTablet) {
                hotseatBarBottom = ResourcesCompat.getFloat(res, R.dimen.hotseat_bar_bottom_space_default_three_button);
            }

            hotseatBarBottomSpace[INDEX_DEFAULT] = a.getFloat(
                    R.styleable.ProfileDisplayOption_hotseatBarBottomSpace,
                    noHintGesture ? ResourcesCompat.getFloat(res, R.dimen.hotseat_qsb_space_default)
                            : ResourcesCompat.getFloat(res, R.dimen.hotseat_bar_bottom_space_default));
                    hotseatBarBottom);
            hotseatBarBottomSpace[INDEX_LANDSCAPE] = a.getFloat(
                    R.styleable.ProfileDisplayOption_hotseatBarBottomSpaceLandscape,
                    hotseatBarBottomSpace[INDEX_DEFAULT]);