summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Chan <jc@lineageos.org>2020-05-24 21:35:34 +0800
committeralk3pInjection <webmaster@raspii.tech>2022-05-07 00:20:58 +0800
commit9143ae3908cae77d1251cc3831dafe73fc863d5a (patch)
tree72dc5887c0e428d19379e7f705de37b630a50683
parent792e2a574bab0b142d3f9b7bd3cebdee343b8a36 (diff)
Settings: Implement hide gestural navigation hint bar [2/2]
Change-Id: I14dd73414c9f7ee1b01f315c9eeae0fd3ac4f859 Signed-off-by: alk3pInjection <webmaster@raspii.tech>
-rw-r--r--res/values/ice_strings.xml4
-rw-r--r--res/xml/gesture_navigation_settings.xml7
-rw-r--r--src/com/android/settings/gestures/HideNavbarPreferenceController.java56
3 files changed, 67 insertions, 0 deletions
diff --git a/res/values/ice_strings.xml b/res/values/ice_strings.xml
index 91f811f95e..ca8bc42b0b 100644
--- a/res/values/ice_strings.xml
+++ b/res/values/ice_strings.xml
@@ -21,4 +21,8 @@
<!-- Double tap to sleep -->
<string name="tap_to_sleep">Tap to sleep</string>
<string name="tap_to_sleep_summary">Double-tap on the home screen or lockscreen to put the device to sleep</string>
+
+ <!-- Navigation bar hint -->
+ <string name="show_navbar_hint_title">Navigation hint</string>
+ <string name="show_navbar_hint_summary">Show navigation hint bar at the bottom of the screen</string>
</resources>
diff --git a/res/xml/gesture_navigation_settings.xml b/res/xml/gesture_navigation_settings.xml
index 09bb870e49..9b41f2da05 100644
--- a/res/xml/gesture_navigation_settings.xml
+++ b/res/xml/gesture_navigation_settings.xml
@@ -23,6 +23,13 @@
android:title="@string/gesture_settings_activity_title"
settings:keywords="@string/keywords_gesture_navigation_settings">
+ <SwitchPreference
+ android:key="navigation_bar_hint"
+ android:title="@string/show_navbar_hint_title"
+ android:summary="@string/show_navbar_hint_summary"
+ settings:controller="com.android.settings.gestures.HideNavbarPreferenceController"
+ />
+
<PreferenceCategory
android:key="assistant_gesture_category"
android:persistent="false"
diff --git a/src/com/android/settings/gestures/HideNavbarPreferenceController.java b/src/com/android/settings/gestures/HideNavbarPreferenceController.java
new file mode 100644
index 0000000000..d2f2ed8278
--- /dev/null
+++ b/src/com/android/settings/gestures/HideNavbarPreferenceController.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 Project ICE
+ *
+ * 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.android.settings.gestures;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.R;
+import com.android.settings.core.TogglePreferenceController;
+
+public class HideNavbarPreferenceController extends TogglePreferenceController {
+
+ public HideNavbarPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public boolean isChecked() {
+ boolean onByDefault = true;
+ return Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.NAVIGATION_BAR_HINT, onByDefault ? 1 : 0)
+ == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ return Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.NAVIGATION_BAR_HINT, isChecked ? 1 : 0);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return SystemNavigationPreferenceController.isGestureAvailable(mContext) ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public int getSliceHighlightMenuRes() {
+ return R.string.menu_key_system;
+ }
+}