diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/NavigationSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/NavigationSettings.java index f1a32da947..8d36c81404 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/NavigationSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/NavigationSettings.java @@ -1,12 +1,17 @@ package com.sevtinge.hyperceiler.ui.fragment.systemui; +import android.provider.Settings; import android.view.View; import com.sevtinge.hyperceiler.R; import com.sevtinge.hyperceiler.ui.base.BaseSettingsActivity; import com.sevtinge.hyperceiler.ui.fragment.base.SettingsPreferenceFragment; +import moralnorm.preference.SwitchPreference; + public class NavigationSettings extends SettingsPreferenceFragment { + SwitchPreference customNav; + @Override public int getContentResId() { return R.xml.system_ui_navigation; @@ -14,9 +19,26 @@ public int getContentResId() { @Override public View.OnClickListener addRestartListener() { - return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog( + return view -> ((BaseSettingsActivity) getActivity()).showRestartDialog( getResources().getString(R.string.system_ui), "com.android.systemui" ); } + + private boolean isGestureNavigationEnabled() { + var defaultNavigationMode = 0; + var gestureNavigationMode = 2; + + return Settings.Secure.getInt(requireContext().getContentResolver(), "navigation_mode", defaultNavigationMode) == gestureNavigationMode; + } + + @Override + public void initPrefs() { + customNav = findPreference("prefs_key_system_ui_navigation_custom"); + if (customNav != null) { + customNav.setEnabled(!isGestureNavigationEnabled()); + customNav.setVisible(customNav.isEnabled()); + } + + } }