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

Commit c5c64359 authored by LuK1337's avatar LuK1337 Committed by Bruno Martins
Browse files

LineageParts: Remove 2 button nav leftovers

Change-Id: I499f026ca997434639105ea982b7eec96750cbcb
parent a5fd5ed4
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2016 The CyanogenMod project
 * SPDX-FileCopyrightText: 2017-2024 The LineageOS project
 * SPDX-FileCopyrightText: 2017-2025 The LineageOS project
 * SPDX-License-Identifier: Apache-2.0
 */

package org.lineageos.lineageparts.input;

import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;

@@ -655,10 +654,6 @@ public class ButtonSettings extends SettingsPreferenceFragment
            return true;
        } else if (preference == mEnableTaskbar) {
            toggleTaskBarDependencies((Boolean) newValue);
            if ((Boolean) newValue && is2ButtonNavigationEnabled(requireContext())) {
                // Let's switch to gestural mode if user previously had 2 buttons enabled.
                setButtonNavigationMode(NAV_BAR_MODE_GESTURAL_OVERLAY);
            }
            LineageSettings.System.putInt(getContentResolver(),
                    LineageSettings.System.ENABLE_TASKBAR, ((Boolean) newValue) ? 1 : 0);
            return true;
@@ -666,11 +661,6 @@ public class ButtonSettings extends SettingsPreferenceFragment
        return false;
    }

    private static boolean is2ButtonNavigationEnabled(Context context) {
        return NAV_BAR_MODE_2BUTTON == context.getResources().getInteger(
                com.android.internal.R.integer.config_navBarInteractionMode);
    }

    private static void setButtonNavigationMode(String overlayPackage) {
        IOverlayManager overlayManager = IOverlayManager.Stub.asInterface(
                ServiceManager.getService(Context.OVERLAY_SERVICE));
@@ -744,13 +734,6 @@ public class ButtonSettings extends SettingsPreferenceFragment
                    mNavigationPreferencesCat.removePreference(mNavigationHomeLongPressAction);
                    mNavigationPreferencesCat.removePreference(mNavigationHomeDoubleTapAction);
                    mNavigationPreferencesCat.removePreference(mNavigationAppSwitchLongPressAction);
                } else if (DeviceUtils.isSwipeUpEnabled(getContext())) {
                    mNavigationPreferencesCat.addPreference(mNavigationBackLongPressAction);
                    mNavigationPreferencesCat.addPreference(mNavigationHomeLongPressAction);
                    mNavigationPreferencesCat.addPreference(mNavigationHomeDoubleTapAction);

                    mNavigationPreferencesCat.removePreference(mNavigationAppSwitchLongPressAction);
                    mNavigationPreferencesCat.removePreference(mEdgeLongSwipeAction);
                } else {
                    mNavigationPreferencesCat.addPreference(mNavigationBackLongPressAction);
                    mNavigationPreferencesCat.addPreference(mNavigationHomeLongPressAction);
@@ -998,9 +981,6 @@ public class ButtonSettings extends SettingsPreferenceFragment
                    result.add(KEY_NAVIGATION_HOME_LONG_PRESS);
                    result.add(KEY_NAVIGATION_HOME_DOUBLE_TAP);
                    result.add(KEY_NAVIGATION_APP_SWITCH_LONG_PRESS);
                } else if (DeviceUtils.isSwipeUpEnabled(context)) {
                    result.add(KEY_NAVIGATION_APP_SWITCH_LONG_PRESS);
                    result.add(KEY_EDGE_LONG_SWIPE);
                } else {
                    result.add(KEY_EDGE_LONG_SWIPE);
                }
+1 −9
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2016 The CyanogenMod project
 * SPDX-FileCopyrightText: 2017-2023 The LineageOS project
 * SPDX-FileCopyrightText: 2017-2025 The LineageOS project
 * SPDX-License-Identifier: Apache-2.0
 */
package org.lineageos.lineageparts.utils;
@@ -270,14 +270,6 @@ public class DeviceUtils {
        return telephonyManager.createForSubscriptionId(subId).isDataEnabled();
    }

    public static boolean isSwipeUpEnabled(Context context) {
        if (isEdgeToEdgeEnabled(context)) {
            return false;
        }
        return NAV_BAR_MODE_2BUTTON == context.getResources().getInteger(
                com.android.internal.R.integer.config_navBarInteractionMode);
    }

    public static boolean isEdgeToEdgeEnabled(Context context) {
        return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger(
                com.android.internal.R.integer.config_navBarInteractionMode);