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

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

feat: Fix hotseat paddings on phones

parent dc820d5c
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -258,6 +258,8 @@ public class DeviceProfile {
    public int dropTargetGapPx;
    public int dropTargetButtonWorkspaceEdgeGapPx;

    private boolean isNoHintGesture = false;

    // Insets
    private final Rect mInsets = new Rect();
    public final Rect workspacePadding = new Rect();
@@ -322,6 +324,9 @@ public class DeviceProfile {
        final Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();

        isNoHintGesture = isGestural() && LineageSettings.System.getInt(
                context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;

        // Determine sizes.
        widthPx = windowBounds.bounds.width();
        heightPx = windowBounds.bounds.height();
@@ -1441,11 +1446,9 @@ public class DeviceProfile {
            float hotseatCellWidth = (float) widthPx / numShownHotseatIcons;
            int hotseatAdjustment = Math.round((workspaceCellWidth - hotseatCellWidth) / 2);
            int hotseatIconMargin = Math.abs(hotseatCellHeightPx - iconSizePx);
            boolean noHint = isFullyGesture && LineageSettings.System.getInt(
                    context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;
            // Values obtained by manual validation, independent of dpi and display scale
            double marginScaleFactor = isFullyGesture
                    ? (noHint ? 2.5 : 3.25)
                    ? (isNoHintGesture ? 2.5 : 3.25)
                    : 2.75;
            hotseatBarPadding.set(
                    hotseatAdjustment + workspacePadding.left + cellLayoutPaddingPx.left
@@ -1453,9 +1456,8 @@ public class DeviceProfile {
                    0,
                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingPx.right
                            + mInsets.right,
                    getHotseatBarBottomPadding()
                            - (int) (marginScaleFactor * hotseatIconMargin)

                    getHotseatBarBottomPadding() -
                            (int) (marginScaleFactor * hotseatIconMargin)
            );
        }
        return hotseatBarPadding;
@@ -1506,11 +1508,11 @@ public class DeviceProfile {
            }

        } else {
            boolean isFullyGesture = isGestural();
            boolean noHint = isFullyGesture && LineageSettings.System.getInt(
                    context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;
            return hotseatBarBottomSpacePx +
                    (int) ((isFullyGesture ? (noHint ? -2.5f : 1f) : 2f) * heightDifference);
            if (isNoHintGesture) {
                return Math.abs(hotseatBarSizePx - iconSizePx) / 2;
            }
            return hotseatBarBottomSpacePx + (int) ((isGestural() ? .75f : 2f)
                    * heightDifference);
        }
    }

@@ -1636,9 +1638,7 @@ public class DeviceProfile {

    private int getDeductibleGestureHeight() {
        if (isVerticalBarLayout() || context == null) return 0;
        boolean noHint = isGestural() && LineageSettings.System.getInt(
                context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;
        if (!noHint) return 0;
        if (!isNoHintGesture) return 0;
        return ResourceUtils.getDimenByName(NAVBAR_BOTTOM_GESTURE_SIZE, context.getResources(), 0);
    }