From 1a3de05f22f5a94a352ec4aae7fa3e9a1e316a40 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan
Date: Wed, 27 Mar 2013 08:49:50 +0700
Subject: Settings: remove Pie control for devices without navbar
Change-Id: Ie0e8994436bce1848f540b50bd15bce77276808d
---
.../settings/cyanogenmod/SystemSettings.java | 38 +++++++++++++---------
1 file 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));
--
cgit v1.1