[2/2] OmniGears: navigation bar visibility control
Change-Id: Ie3707a7e215db42700edf15ef3b239cbeca6b6a8
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index ff77879..18fb473 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -19,6 +19,18 @@
android:title="@string/button_settings_title" >
<PreferenceCategory
+ android:key="button_keys"
+ android:title="@string/button_keys_title" >
+
+ <org.omnirom.omnilib.preference.SystemSettingSwitchPreference
+ android:key="navigation_bar_show"
+ android:title="@string/navigation_bar_show_title"
+ android:summary="@string/navigation_bar_show_summary"
+ android:defaultValue="false" />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
android:key="button_power"
android:title="@string/global_actions_power_title" >
diff --git a/src/org/omnirom/omnigears/ButtonSettings.java b/src/org/omnirom/omnigears/ButtonSettings.java
index 6fc29c6..4511ae6 100644
--- a/src/org/omnirom/omnigears/ButtonSettings.java
+++ b/src/org/omnirom/omnigears/ButtonSettings.java
@@ -50,14 +50,19 @@
import com.android.internal.util.omni.PackageUtils;
import com.android.internal.util.omni.DeviceUtils;
+import org.omnirom.omnilib.preference.SystemSettingSwitchPreference;
+
public class ButtonSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener, Indexable {
+ private static final String CATEGORY_KEYS = "button_keys";
private static final String CATEGORY_OTHER = "button_other";
private static final String CATEGORY_POWER = "button_power";
+ private static final String KEYS_SHOW_NAVBAR_KEY = "navigation_bar_show";
private static final String NAVIGATION_BAR_RECENTS_STYLE = "navbar_recents_style";
private static final String SYSTEM_PROXI_CHECK_ENABLED = "system_proxi_check_enabled";
private ListPreference mNavbarRecentsStyle;
+ private SystemSettingSwitchPreference mEnableNavBar;
@Override
public int getMetricsCategory() {
@@ -72,11 +77,19 @@
final ContentResolver resolver = getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
+ final PreferenceCategory keysCategory =
+ (PreferenceCategory) prefScreen.findPreference(CATEGORY_KEYS);
final PreferenceCategory otherCategory =
(PreferenceCategory) prefScreen.findPreference(CATEGORY_OTHER);
final PreferenceCategory powerCategory =
(PreferenceCategory) prefScreen.findPreference(CATEGORY_POWER);
+ boolean showNavBarDefault = DeviceUtils.deviceSupportNavigationBar(getActivity());
+ boolean showNavBar = Settings.System.getInt(resolver,
+ Settings.System.OMNI_NAVIGATION_BAR_SHOW, showNavBarDefault ? 1 : 0) == 1;
+ mEnableNavBar = (SystemSettingSwitchPreference) prefScreen.findPreference(KEYS_SHOW_NAVBAR_KEY);
+ mEnableNavBar.setChecked(showNavBar);
+
mNavbarRecentsStyle = (ListPreference) findPreference(NAVIGATION_BAR_RECENTS_STYLE);
int recentsStyle = Settings.System.getInt(resolver,
Settings.System.OMNI_NAVIGATION_BAR_RECENTS, 0);