diff options
author | crizmess <jens.doll@gmail.com> | 2013-03-18 20:40:21 +0100 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2013-03-25 18:08:15 -0400 |
commit | e5bba18990fb2cbb4e777e6bd81a97254d909462 (patch) | |
tree | d7c296ee82aa03d406fb67f443975a5bec6e43b3 /src/com/android/settings/cyanogenmod/SystemSettings.java | |
parent | 5814f08554e053081e76e7dcf6e8ff804ae5d713 (diff) | |
download | packages_apps_settings-e5bba18990fb2cbb4e777e6bd81a97254d909462.zip packages_apps_settings-e5bba18990fb2cbb4e777e6bd81a97254d909462.tar.gz packages_apps_settings-e5bba18990fb2cbb4e777e6bd81a97254d909462.tar.bz2 |
Bringing basic Pie controls to CyanogenMod. (2/2)
This is the settings part of the pie commit, for the real implementation
look in frameworks/base.
Patch Set 3:
* CyanogenMod Code Style
Patch Set 4:
* Strings cleanup
* Better integration into CyanogenMod system settings UX
* Some related cleanup in SysteSettings.java
Patch Set 5 and 6:
* Rename feature to Quick controls to match AOSP terminology
Patch Set 7:
* Remove WIP
Patch Set 8:
* Revert name to Pie controls
Patch Set 11:
* Fix broken revert
* Fix spelling of search
Change-Id: I47599316273d8e46017f49ba62a02cc55a785678
Diffstat (limited to 'src/com/android/settings/cyanogenmod/SystemSettings.java')
-rw-r--r-- | src/com/android/settings/cyanogenmod/SystemSettings.java | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java index 1c07877..889dc04 100644 --- a/src/com/android/settings/cyanogenmod/SystemSettings.java +++ b/src/com/android/settings/cyanogenmod/SystemSettings.java @@ -48,9 +48,11 @@ public class SystemSettings extends SettingsPreferenceFragment { private static final String KEY_QUICK_SETTINGS = "quick_settings_panel"; private static final String KEY_NOTIFICATION_DRAWER = "notification_drawer"; private static final String KEY_POWER_MENU = "power_menu"; + private static final String KEY_PIE_CONTROL = "pie_control"; private PreferenceScreen mNotificationPulse; private PreferenceScreen mBatteryPulse; + private PreferenceScreen mPieControl; private boolean mIsPrimary; @Override @@ -70,8 +72,7 @@ public class SystemSettings extends SettingsPreferenceFragment { if (getResources().getBoolean( com.android.internal.R.bool.config_intrusiveBatteryLed) == false) { prefScreen.removePreference(mBatteryPulse); - } else { - updateBatteryPulseDescription(); + mBatteryPulse = null; } } @@ -119,15 +120,40 @@ public class SystemSettings extends SettingsPreferenceFragment { if (mNotificationPulse != null) { if (!getResources().getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) { prefScreen.removePreference(mNotificationPulse); - } else { - updateLightPulseDescription(); + mNotificationPulse = null; } } + // Pie controls + mPieControl = (PreferenceScreen) findPreference(KEY_PIE_CONTROL); + // Don't display the lock clock preference if its not installed removePreferenceIfPackageNotInstalled(findPreference(KEY_LOCK_CLOCK)); } + @Override + public void onResume() { + super.onResume(); + + // All users + if (mNotificationPulse != null) { + updateLightPulseDescription(); + } + if (mPieControl != null) { + updatePieControlDescription(); + } + + // Primary user only + if (mIsPrimary && mBatteryPulse != null) { + updateBatteryPulseDescription(); + } + } + + @Override + public void onPause() { + super.onPause(); + } + private void updateLightPulseDescription() { if (Settings.System.getInt(getActivity().getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE, 0) == 1) { @@ -146,24 +172,15 @@ public class SystemSettings extends SettingsPreferenceFragment { } } - @Override - public void onResume() { - super.onResume(); - - // All users - updateLightPulseDescription(); - - // Primary user only - if (mIsPrimary) { - updateBatteryPulseDescription(); + private void updatePieControlDescription() { + if (Settings.System.getInt(getActivity().getContentResolver(), + Settings.System.PIE_CONTROLS, 0) == 1) { + mPieControl.setSummary(getString(R.string.pie_control_enabled)); + } else { + mPieControl.setSummary(getString(R.string.pie_control_disabled)); } } - @Override - public void onPause() { - super.onPause(); - } - private boolean removePreferenceIfPackageNotInstalled(Preference preference) { String intentUri = ((PreferenceScreen) preference).getIntent().toUri(1); Pattern pattern = Pattern.compile("component=([^/]+)/"); |