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

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

Merge branch '2886-a14-hotseat' into 'a14'

Fix hotseat spacing

See merge request e/os/BlissLauncher3!104
parents 9b31d023 fd54be8c
Loading
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
    private val mAppMonitorCallback: LauncherAppMonitorCallback =
        object : LauncherAppMonitorCallback {
            override fun onLoadAllAppsEnd(apps: ArrayList<AppInfo?>?) {
                val launcherModel = monitor.launcher?.model
                if (launcherModel != null) {
                    MODEL_EXECUTOR.submit(
                        VerifyIdleAppTask(
                            context,
@@ -42,15 +44,16 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
                            null,
                            null,
                            false,
                        monitor.launcher.model.mBgDataModel
                            launcherModel.mBgDataModel
                        )
                    )
                }
            }

            override fun onAppSharedPreferenceChanged(key: String?) {
                when (key) {
                    BlissPrefs.PREF_SINGLE_LAYER_MODE -> {
                        monitor.launcher.model.forceReload()
                        monitor.launcher?.model?.forceReload()
                    }
                    BlissPrefs.PREF_NOTIF_COUNT -> idp.onConfigChanged(context)
                    else -> Unit
+18 −22
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@ public class DeviceProfile {
    private CalculatedCellSpec mResponsiveAllAppsCellSpec;

    private boolean isNoHintGesture = false;
    private boolean isNoButtonGesture = false;

    /**
     * The maximum amount of left/right workspace padding as a percentage of the screen width.
@@ -370,9 +369,7 @@ public class DeviceProfile {
                LineageSettings.System.ENABLE_TASKBAR, isTablet ? 1 : 0) == 1;
        isTaskbarPresent = isTaskBarEnabled && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;

        WindowManagerProxy wm = WindowManagerProxy.newInstance(context);
        isNoButtonGesture = wm.getNavigationMode(context) == NavigationMode.NO_BUTTON;
        isNoHintGesture = isNoButtonGesture && LineageSettings.System.getInt(
        isNoHintGesture = isGestural() && LineageSettings.System.getInt(
                context.getContentResolver(), LineageSettings.System.NAVIGATION_BAR_HINT, 0) != 1;

        // Some more constants.
@@ -1821,7 +1818,11 @@ public class DeviceProfile {
     */
    public Rect getHotseatLayoutPadding(Context context) {
        // Make sure to update all relevant sizes for cutout and orientation
        updateHotseatSizes(pxFromDp(inv.iconSize[mTypeIndex], mMetrics));
        int hotseatIconSizePx = pxFromDp(inv.iconSize[mTypeIndex], mMetrics);
        if (!isTaskbarPresent && isNoHintGesture) {
            hotseatIconSizePx = (int) (hotseatIconSizePx / 1.2f);
        }
        updateHotseatSizes(hotseatIconSizePx);
        Rect hotseatBarPadding = new Rect();
        boolean isFullyGesture = isGestural();
        if (isVerticalBarLayout()) {
@@ -1887,21 +1888,16 @@ 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)
                    : 2.75;
            double marginScaleFactor = isFullyGesture ? 3.25 : 2.75;
            hotseatBarPadding.set(
                    hotseatAdjustment + workspacePadding.left + cellLayoutPaddingPx.left
                            + mInsets.left,
                    0,
                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingPx.right
                            + mInsets.right,
                    getHotseatBarBottomPadding()
                            - (int) (marginScaleFactor * hotseatIconMargin)

                    getHotseatBarBottomPadding() -
                            (int) (marginScaleFactor * hotseatIconMargin)
            );
        }
        return hotseatBarPadding;
@@ -1976,17 +1972,19 @@ public class DeviceProfile {
        if (isTaskbarPresent) { // QSB on top or inline
            if (isGestural()) {
                if (isLandscape) {
                    return 0;
                    return -1;
                } else {
                    return  heightDifference / 2;
                    return heightDifference / 5;
                }
            } else {
                return hotseatBarBottomSpacePx - (heightDifference / 2);
                return hotseatBarBottomSpacePx - heightDifference;
            }

        } else {
            return hotseatBarBottomSpacePx +
                    (int) ((isGestural() ? (isNoHintGesture ? -2.5f : 1f) : 2f) * heightDifference);
            if (isNoHintGesture) {
                return (int) (Math.abs(hotseatBarSizePx - iconSizePx) / 2.2f);
            }
            return hotseatBarBottomSpacePx + (int) ((isGestural() ? .75f : 2f)
                    * heightDifference);
        }
    }

@@ -2107,9 +2105,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);
    }