diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml
index 10d211c..30ee384 100644
--- a/res/values/cherish_strings.xml
+++ b/res/values/cherish_strings.xml
@@ -591,10 +591,6 @@
Backlight timeout
Button backlight touch
Button backlight will only appear when buttons are pressed rather than on all the time. Timeout still impacts this feature.
-
-
- Hardware navigation buttons
- Disable hardware buttons
Screen off animation
@@ -722,4 +718,35 @@
Use black theme
Force black background colors
+
+ Skip music tracks
+
+
+ Navigatie
+ Navigation bar
+ On-screen navigation bar
+ Enable on-screen navigation keys
+ Layout
+ Customize the layout of the navigation bar
+ Show arrow keys while typing
+ Display left and right cursor buttons in navigation bar while typing
+ These settings mainly relate to the 3-button navigation bar. If you use gesture navigation and want to customize it, e.g. hide the gesture handle, please visit: Settings > System > Gestures.
+ Navigation bar tuner
+ Change nav bar layout
+ Layout
+ Normal
+ Compact
+ Left-leaning
+ Right-leaning
+ Choose which system navigation style to use
+
+
+ Buttons
+ Hardware navigation buttons
+ Disable hardware buttons
+ Use the device hardware keys for navigation
+
+
+ Invert 3 button navigation bar
+
diff --git a/res/xml/cherish_settings_button.xml b/res/xml/cherish_settings_button.xml
index b342095..79631da 100644
--- a/res/xml/cherish_settings_button.xml
+++ b/res/xml/cherish_settings_button.xml
@@ -18,18 +18,53 @@
android:title="@string/button_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
+
-
-
+
+
+
+
+
+
+ android:title="@string/button_backlight_options_category">
+ android:defaultValue="true" />
-
-
-
-
+
+
+ android:title="@string/hardware_keys_single_tap_title">
+ android:title="@string/hardware_keys_long_press_title">
+ android:title="@string/hardware_keys_double_tap_title">
-
-
+
+
+ android:title="@string/hardware_keys_single_tap_title">
+ android:title="@string/hardware_keys_long_press_title">
+ android:title="@string/hardware_keys_double_tap_title">
+ android:title="@string/hardware_keys_appswitch_key_title">
+ android:title="@string/hardware_keys_single_tap_title">
+ android:title="@string/hardware_keys_long_press_title">
+ android:title="@string/hardware_keys_double_tap_title">
+ android:title="@string/hardware_keys_menu_key_title">
+ android:title="@string/hardware_keys_single_tap_title">
+ android:title="@string/hardware_keys_long_press_title">
+ android:title="@string/hardware_keys_double_tap_title">
+ android:title="@string/hardware_keys_assist_key_title">
+ android:title="@string/hardware_keys_single_tap_title">
+ android:title="@string/hardware_keys_long_press_title">
+ android:title="@string/hardware_keys_double_tap_title">
diff --git a/src/com/cherish/settings/fragments/ButtonSettings.java b/src/com/cherish/settings/fragments/ButtonSettings.java
index 925aa77..437a6ef 100644
--- a/src/com/cherish/settings/fragments/ButtonSettings.java
+++ b/src/com/cherish/settings/fragments/ButtonSettings.java
@@ -38,7 +38,9 @@ import android.widget.Toast;
import com.android.settings.R;
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
import com.cherish.settings.preferences.SecureSettingSwitchPreference;
+import com.android.internal.cherish.hardware.LineageHardwareManager;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.util.cherish.CherishUtils;
import com.android.settings.SettingsPreferenceFragment;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.Utils;
@@ -56,10 +58,18 @@ import android.provider.SearchIndexableResource;
import java.util.ArrayList;
import java.util.List;
+
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ButtonSettings extends ActionFragment implements OnPreferenceChangeListener {
private static final String HWKEY_DISABLE = "hardware_keys_disable";
+ private static final String NAVBAR_VISIBILITY = "navbar_visibility";
+ private static final String KEY_LAYOUT_SETTINGS = "layout_settings";
+ private static final String KEY_NAVIGATION_BAR_ARROWS = "navigation_bar_menu_arrow_keys";
// category keys
private static final String CATEGORY_HWKEY = "hardware_keys";
@@ -92,6 +102,13 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
private CustomSeekBarPreference mButtonTimoutBar;
private CustomSeekBarPreference mManualButtonBrightness;
private PreferenceCategory mButtonBackLightCategory;
+ private SwitchPreference mNavbarVisibility;
+ private Preference mLayoutSettings;
+ private SystemSettingSwitchPreference mNavigationArrows;
+
+ private boolean mIsNavSwitchingMode = false;
+
+ private Handler mHandler;
@Override
public void onCreate(Bundle icicle) {
@@ -182,6 +199,16 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
mManualButtonBrightness.setMax(pm.getMaximumScreenBrightnessSetting());
mManualButtonBrightness.setValue(currentBrightness);
mManualButtonBrightness.setOnPreferenceChangeListener(this);
+
+ mNavbarVisibility = (SwitchPreference) findPreference(NAVBAR_VISIBILITY);
+
+ boolean showing = Settings.System.getIntForUser(resolver,
+ Settings.System.FORCE_SHOW_NAVBAR,
+ CherishUtils.hasNavbarByDefault(getActivity()) ? 1 : 0, UserHandle.USER_CURRENT) != 0;
+ mNavbarVisibility.setChecked(showing);
+ mNavbarVisibility.setOnPreferenceChangeListener(this);
+
+ mHandler = new Handler();
mButtonTimoutBar = (CustomSeekBarPreference) findPreference(KEY_BUTTON_TIMEOUT);
int currentTimeout = Settings.System.getInt(resolver,
@@ -197,6 +224,10 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
if (!enableBacklightOptions) {
prefScreen.removePreference(mButtonBackLightCategory);
}
+
+ mLayoutSettings = (Preference) findPreference(KEY_LAYOUT_SETTINGS);
+
+ mNavigationArrows = (SystemSettingSwitchPreference) findPreference(KEY_NAVIGATION_BAR_ARROWS);
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -213,19 +244,35 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
boolean value = (Boolean) newValue;
Settings.System.putInt(getContentResolver(), Settings.System.HARDWARE_KEYS_DISABLE,
value ? 1 : 0);
- setActionPreferencesEnabled(!value);
+ return true;
} else if (preference == mButtonTimoutBar) {
int buttonTimeout = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.BUTTON_BACKLIGHT_TIMEOUT, buttonTimeout);
+ return true;
} else if (preference == mManualButtonBrightness) {
int buttonBrightness = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.CUSTOM_BUTTON_BRIGHTNESS, buttonBrightness);
- } else {
- return false;
+ return true;
+ } else if (preference == mNavbarVisibility) {
+ if (mIsNavSwitchingMode) {
+ return false;
+ }
+ mIsNavSwitchingMode = true;
+ boolean showing = ((Boolean)newValue);
+ Settings.System.putIntForUser(resolver, Settings.System.FORCE_SHOW_NAVBAR,
+ showing ? 1 : 0, UserHandle.USER_CURRENT);
+ mNavbarVisibility.setChecked(showing);
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mIsNavSwitchingMode = false;
+ }
+ }, 1500);
+ return true;
}
- return true;
+ return false;
}
@Override
@@ -233,6 +280,11 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
}
+ private static boolean isKeyDisablerSupported(Context context) {
+ final LineageHardwareManager hardware = LineageHardwareManager.getInstance(context);
+ return hardware.isSupported(LineageHardwareManager.FEATURE_KEY_DISABLE);
+ }
+
@Override
protected boolean usesExtendedActionsList() {
return true;
diff --git a/src/com/cherish/settings/fragments/NavBarInversePreferenceController.kt b/src/com/cherish/settings/fragments/NavBarInversePreferenceController.kt
new file mode 100644
index 0000000..432a9fd
--- /dev/null
+++ b/src/com/cherish/settings/fragments/NavBarInversePreferenceController.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 AOSP-Krypton Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cherish.settings.fragments
+
+import android.content.Context
+import android.os.UserHandle
+import android.provider.Settings
+
+import com.cherish.settings.CherishBasePreferenceController
+
+class NavBarInversePreferenceController(
+ context: Context,
+ key: String,
+): CherishBasePreferenceController(context, key) {
+
+ override fun getAvailabilityStatus(): Int {
+ val threeButtonMode = Settings.Secure.getIntForUser(
+ mContext.contentResolver,
+ Settings.Secure.NAVIGATION_MODE,
+ 0,
+ UserHandle.USER_CURRENT,
+ ) == 0
+ return if (threeButtonMode)
+ AVAILABLE
+ else
+ DISABLED_DEPENDENT_SETTING
+ }
+}