diff options
-rw-r--r-- | res/values/arrays.xml | 10 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/PowerMenu.java | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml index c70cf13..b901648 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1239,6 +1239,16 @@ <item>2</item> </string-array> + <string-array name="expanded_desktop_entries_no_navbar" translatable="false"> + <item>@string/expanded_desktop_disabled</item> + <item>@string/expanded_desktop_no_status_bar</item> + </string-array> + + <string-array name="expanded_desktop_values_no_navbar" translatable="false"> + <item>0</item> + <item>2</item> + </string-array> + <!-- Quick pulldown --> <string-array name="quick_pulldown_entries" translatable="false"> <item>@string/quick_pulldown_off</item> diff --git a/src/com/android/settings/cyanogenmod/PowerMenu.java b/src/com/android/settings/cyanogenmod/PowerMenu.java index 3d74d87..44a195c 100644 --- a/src/com/android/settings/cyanogenmod/PowerMenu.java +++ b/src/com/android/settings/cyanogenmod/PowerMenu.java @@ -18,6 +18,7 @@ package com.android.settings.cyanogenmod; import android.content.res.Resources; import android.os.Bundle; +import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.preference.CheckBoxPreference; @@ -26,6 +27,8 @@ import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceScreen; import android.provider.Settings; +import android.util.Log; +import android.view.WindowManagerGlobal; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; @@ -71,6 +74,16 @@ public class PowerMenu extends SettingsPreferenceFragment implements mExpandedDesktopPref.setValue(String.valueOf(expandedDesktopValue)); updateExpandedDesktopSummary(expandedDesktopValue); + // Hide no-op "Status bar visible" mode on devices without navbar + try { + if (!WindowManagerGlobal.getWindowManagerService().hasNavigationBar()) { + mExpandedDesktopPref.setEntries(R.array.expanded_desktop_entries_no_navbar); + mExpandedDesktopPref.setEntryValues(R.array.expanded_desktop_values_no_navbar); + } + } catch (RemoteException e) { + Log.e(TAG, "Error getting navigation bar status"); + } + mProfilesPref = (CheckBoxPreference) findPreference(KEY_PROFILES); mProfilesPref.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.POWER_MENU_PROFILES_ENABLED, 1) == 1)); @@ -159,6 +172,9 @@ public class PowerMenu extends SettingsPreferenceFragment implements Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_EXPANDED_DESKTOP_ENABLED, 0); mExpandedDesktopPref.setSummary(res.getString(R.string.expanded_desktop_disabled)); + // Disable expanded desktop if enabled + Settings.System.putInt(getContentResolver(), + Settings.System.EXPANDED_DESKTOP_STATE, 0); } else if (value == 1) { Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_EXPANDED_DESKTOP_ENABLED, 1); |