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

Commit d0ddb50f authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Saalim Quadri
Browse files

feat: Fix hotseat paddings

parent 59bf140a
Loading
Loading
Loading
Loading
+13 −8
Original line number Original line Diff line number Diff line
@@ -55,7 +55,6 @@ import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
import com.android.launcher3.DevicePaddings.DevicePadding;
import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.responsive.CalculatedCellSpec;
import com.android.launcher3.responsive.CalculatedCellSpec;
import com.android.launcher3.responsive.CalculatedHotseatSpec;
import com.android.launcher3.responsive.CalculatedHotseatSpec;
@@ -143,6 +142,9 @@ public class DeviceProfile {
    private CalculatedCellSpec mResponsiveWorkspaceCellSpec;
    private CalculatedCellSpec mResponsiveWorkspaceCellSpec;
    private CalculatedCellSpec mResponsiveAllAppsCellSpec;
    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.
     * The maximum amount of left/right workspace padding as a percentage of the screen width.
     * To be clear, this means that up to 7% of the screen width can be used as left padding, and
     * To be clear, this means that up to 7% of the screen width can be used as left padding, and
@@ -321,7 +323,6 @@ public class DeviceProfile {
    public final boolean isTransientTaskbar;
    public final boolean isTransientTaskbar;
    // DragController
    // DragController
    public int flingToDeleteThresholdVelocity;
    public int flingToDeleteThresholdVelocity;
    private final Context context;


    /** Used only as an alternative to mocking when null values cannot be used. */
    /** Used only as an alternative to mocking when null values cannot be used. */
    @VisibleForTesting
    @VisibleForTesting
@@ -430,6 +431,11 @@ public class DeviceProfile {
        isTaskbarPresent = isTaskBarEnabled
        isTaskbarPresent = isTaskBarEnabled
                && WindowManagerProxy.INSTANCE.get(context).isTaskbarDrawnInProcess();
                && WindowManagerProxy.INSTANCE.get(context).isTaskbarDrawnInProcess();


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

        // Some more constants.
        // Some more constants.
        context = getContext(context, info, isVerticalBarLayout() || (isTablet && isLandscape)
        context = getContext(context, info, isVerticalBarLayout() || (isTablet && isLandscape)
                        ? Configuration.ORIENTATION_LANDSCAPE
                        ? Configuration.ORIENTATION_LANDSCAPE
@@ -871,7 +877,6 @@ public class DeviceProfile {
        // This is done last, after iconSizePx is calculated above.
        // This is done last, after iconSizePx is calculated above.
        mDotRendererWorkSpace = createDotRenderer(context, iconSizePx, dotRendererCache, showNotificationCount, typeface);
        mDotRendererWorkSpace = createDotRenderer(context, iconSizePx, dotRendererCache, showNotificationCount, typeface);
        mDotRendererAllApps = createDotRenderer(context, allAppsIconSizePx, dotRendererCache, showNotificationCount, typeface);
        mDotRendererAllApps = createDotRenderer(context, allAppsIconSizePx, dotRendererCache, showNotificationCount, typeface);
        this.context = context;
    }
    }


    private static DotRenderer createDotRenderer(
    private static DotRenderer createDotRenderer(
@@ -2018,14 +2023,14 @@ public class DeviceProfile {
     * Returns the number of pixels the hotseat is translated from the bottom of the screen.
     * Returns the number of pixels the hotseat is translated from the bottom of the screen.
     */
     */
    private int getHotseatBarBottomPadding() {
    private int getHotseatBarBottomPadding() {
        WindowManagerProxy wm = WindowManagerProxy.newInstance(context);
        boolean isFullyGesture = wm.getNavigationMode(context) == NavigationMode.NO_BUTTON;

        if (isTaskbarPresent) { // QSB on top or inline
        if (isTaskbarPresent) { // QSB on top or inline
            return hotseatBarBottomSpacePx - (Math.abs(hotseatCellHeightPx - iconSizePx) / 2);
            return hotseatBarBottomSpacePx - (Math.abs(hotseatCellHeightPx - iconSizePx) / 2);
        } else {
        } else {
            int size = hotseatBarSizePx - hotseatCellHeightPx;
            if (isNoHintGesture) return 0;
            return isFullyGesture ? size / 4 : Math.round(size / 1.5f);
            if (isNoButtonGesture) {
                return Math.abs(hotseatBarSizePx - iconSizePx) / 2;
            }
            return hotseatBarSizePx - hotseatCellHeightPx;
        }
        }
    }
    }