Make OP selection toggle the correct options
Change-Id: Iff91b9cce0fcbb2e48de179bcf55cd176260901b
diff --git a/res/xml/navigation_bar.xml b/res/xml/navigation_bar.xml
index 18125e7..8f09028 100644
--- a/res/xml/navigation_bar.xml
+++ b/res/xml/navigation_bar.xml
@@ -107,7 +107,6 @@
android:key="burn_in_protection"
android:title="@string/burn_in_protection_title"
android:summary="@string/burn_in_protection_summary"
- android:dependency="navbar_visibility"
android:defaultValue="true" />
<com.bliss.support.preferences.CustomSeekBarPreference
diff --git a/src/com/android/settings/smartnav/NavigationBarSettings.java b/src/com/android/settings/smartnav/NavigationBarSettings.java
index e75de99..134be24 100644
--- a/src/com/android/settings/smartnav/NavigationBarSettings.java
+++ b/src/com/android/settings/smartnav/NavigationBarSettings.java
@@ -51,6 +51,7 @@
private static final String KEY_FLING_NAVBAR_SETTINGS = "fling_settings";
private static final String KEY_CATEGORY_NAVIGATION_INTERFACE = "category_navbar_interface";
private static final String KEY_CATEGORY_NAVIGATION_GENERAL = "category_navbar_general";
+ private static final String KEY_CATEGORY_NAVIGATION_BURNIN = "navigation_burnin";
private static final String KEY_NAVIGATION_BAR_LEFT = "navigation_bar_left";
private static final String KEY_SMARTBAR_SETTINGS = "smartbar_settings";
private static final String KEY_NAVIGATION_HEIGHT_PORT = "navbar_height_portrait";
@@ -64,6 +65,7 @@
private PreferenceScreen mFlingSettings;
private PreferenceCategory mNavInterface;
private PreferenceCategory mNavGeneral;
+ private PreferenceCategory mNavBurnin;
private PreferenceScreen mSmartbarSettings;
private Preference mDefaultSettings;
private Preference mOPSettings;
@@ -81,6 +83,7 @@
mNavInterface = (PreferenceCategory) findPreference(KEY_CATEGORY_NAVIGATION_INTERFACE);
mNavGeneral = (PreferenceCategory) findPreference(KEY_CATEGORY_NAVIGATION_GENERAL);
+ mNavBurnin = (PreferenceCategory) findPreference(KEY_CATEGORY_NAVIGATION_BURNIN);
mNavbarVisibility = (SwitchPreference) findPreference(NAVBAR_VISIBILITY);
mNavbarMode = (ListPreference) findPreference(KEY_NAVBAR_MODE);
mDefaultSettings = (Preference) findPreference(KEY_DEFAULT_NAVBAR_SETTINGS);
@@ -138,6 +141,7 @@
case 0:
mDefaultSettings.setEnabled(true);
mDefaultSettings.setSelectable(true);
+ enableDefault();
if (isPieRecentsEnabled()) {
mSwipeupSettings.setEnabled(true);
mSwipeupSettings.setSelectable(true);
@@ -156,6 +160,7 @@
mDefaultSettings.setEnabled(false);
mDefaultSettings.setSelectable(false);
disableSwipeup();
+ enableDefault();
mSwipeupSettings.setEnabled(false);
mSwipeupSettings.setSelectable(false);
mSmartbarSettings.setEnabled(true);
@@ -169,6 +174,7 @@
mDefaultSettings.setEnabled(false);
mDefaultSettings.setSelectable(false);
disableSwipeup();
+ enableDefault();
mSwipeupSettings.setEnabled(false);
mSwipeupSettings.setSelectable(false);
mSmartbarSettings.setEnabled(false);
@@ -184,6 +190,7 @@
mDefaultSettings.setEnabled(false);
mDefaultSettings.setSelectable(false);
disableSwipeup();
+ enableOP();
mSwipeupSettings.setEnabled(false);
mSwipeupSettings.setSelectable(false);
mSmartbarSettings.setEnabled(false);
@@ -204,10 +211,26 @@
Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, 0);
}
+ private void enableDefault() {
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.NAVIGATION_BAR_VISIBLE, 1);
+
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.OMNI_USE_BOTTOM_GESTURE_NAVIGATION, 0);
+ }
+
+ private void enableOP() {
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.OMNI_USE_BOTTOM_GESTURE_NAVIGATION, 1);
+
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.NAVIGATION_BAR_VISIBLE, 0);
+ }
+
private void updateBarVisibleAndUpdatePrefs(boolean showing) {
mNavbarVisibility.setChecked(showing);
- mNavInterface.setEnabled(mNavbarVisibility.isChecked());
mNavGeneral.setEnabled(mNavbarVisibility.isChecked());
+ mNavBurnin.setEnabled(mNavbarVisibility.isChecked());
}
@Override