diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2013-03-27 08:49:50 +0700 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2013-03-26 23:09:47 -0400 |
commit | 1a3de05f22f5a94a352ec4aae7fa3e9a1e316a40 (patch) | |
tree | cb73657d0dabb8749db35c4940651db3c18e43e0 | |
parent | e5bba18990fb2cbb4e777e6bd81a97254d909462 (diff) | |
download | packages_apps_settings-1a3de05f22f5a94a352ec4aae7fa3e9a1e316a40.zip packages_apps_settings-1a3de05f22f5a94a352ec4aae7fa3e9a1e316a40.tar.gz packages_apps_settings-1a3de05f22f5a94a352ec4aae7fa3e9a1e316a40.tar.bz2 |
Settings: remove Pie control for devices without navbar
Change-Id: Ie0e8994436bce1848f540b50bd15bce77276808d
-rw-r--r-- | src/com/android/settings/cyanogenmod/SystemSettings.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java index 889dc04..9e05b71 100644 --- a/src/com/android/settings/cyanogenmod/SystemSettings.java +++ b/src/com/android/settings/cyanogenmod/SystemSettings.java @@ -62,6 +62,23 @@ public class SystemSettings extends SettingsPreferenceFragment { addPreferencesFromResource(R.xml.system_settings); PreferenceScreen prefScreen = getPreferenceScreen(); + // Only show the hardware keys config on a device that does not have a navbar + // and the navigation bar config on phones that has a navigation bar + boolean removeKeys = false; + boolean removeNavbar = false; + + IWindowManager windowManager = IWindowManager.Stub.asInterface( + ServiceManager.getService(Context.WINDOW_SERVICE)); + try { + if (windowManager.hasNavigationBar()) { + removeKeys = true; + } else { + removeNavbar = true; + } + } catch (RemoteException e) { + // Do nothing + } + // Determine which user is logged in mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER; if (mIsPrimary) { @@ -76,22 +93,6 @@ public class SystemSettings extends SettingsPreferenceFragment { } } - // Only show the hardware keys config on a device that does not have a navbar - // and the navigation bar config on phones that has a navigation bar - boolean removeKeys = false; - boolean removeNavbar = false; - IWindowManager windowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - try { - if (windowManager.hasNavigationBar()) { - removeKeys = true; - } else { - removeNavbar = true; - } - } catch (RemoteException e) { - // Do nothing - } - // Act on the above if (removeKeys) { prefScreen.removePreference(findPreference(KEY_HARDWARE_KEYS)); @@ -126,6 +127,11 @@ public class SystemSettings extends SettingsPreferenceFragment { // Pie controls mPieControl = (PreferenceScreen) findPreference(KEY_PIE_CONTROL); + if (mPieControl != null && removeNavbar) { + // Remove on devices without a navbar to start with + prefScreen.removePreference(mPieControl); + mPieControl = null; + } // Don't display the lock clock preference if its not installed removePreferenceIfPackageNotInstalled(findPreference(KEY_LOCK_CLOCK)); |