diff options
author | DvTonder <david.vantonder@gmail.com> | 2012-11-28 19:50:04 -0500 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2012-11-28 19:50:04 -0500 |
commit | 082d592e35f6f4260438f6bbc33ac2b6b64287e6 (patch) | |
tree | c880748a28cdc0dab4cf79f629401bd1fcbe96da /src/com/android/settings/cyanogenmod/SystemSettings.java | |
parent | 7904ef403daf9c23f6e744ad7a9126e8dd0a888f (diff) | |
download | packages_apps_settings-082d592e35f6f4260438f6bbc33ac2b6b64287e6.zip packages_apps_settings-082d592e35f6f4260438f6bbc33ac2b6b64287e6.tar.gz packages_apps_settings-082d592e35f6f4260438f6bbc33ac2b6b64287e6.tar.bz2 |
Settings: Move Notification and Battery light settings to System settings
In an attempt to make the LED settings more discoverable, move it from
Display to System settings.
Change-Id: I374cdd08f330ff367405d204b5eb073efa98f04d
Diffstat (limited to 'src/com/android/settings/cyanogenmod/SystemSettings.java')
-rw-r--r-- | src/com/android/settings/cyanogenmod/SystemSettings.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java index b16dc15..586ef07 100644 --- a/src/com/android/settings/cyanogenmod/SystemSettings.java +++ b/src/com/android/settings/cyanogenmod/SystemSettings.java @@ -17,6 +17,8 @@ package com.android.settings.cyanogenmod; import android.os.Bundle; +import android.preference.PreferenceScreen; +import android.provider.Settings; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; @@ -24,16 +26,60 @@ import com.android.settings.SettingsPreferenceFragment; public class SystemSettings extends SettingsPreferenceFragment { private static final String TAG = "SystemSettings"; + private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; + private static final String KEY_BATTERY_LIGHT = "battery_light"; + + private PreferenceScreen mNotificationPulse; + private PreferenceScreen mBatteryPulse; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.system_settings); + mNotificationPulse = (PreferenceScreen) findPreference(KEY_NOTIFICATION_PULSE); + if (mNotificationPulse != null) { + if (!getResources().getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) { + getPreferenceScreen().removePreference(mNotificationPulse); + } else { + updateLightPulseDescription(); + } + } + + mBatteryPulse = (PreferenceScreen) findPreference(KEY_BATTERY_LIGHT); + if (mBatteryPulse != null) { + if (getResources().getBoolean( + com.android.internal.R.bool.config_intrusiveBatteryLed) == false) { + getPreferenceScreen().removePreference(mBatteryPulse); + } else { + updateBatteryPulseDescription(); + } + } } + private void updateLightPulseDescription() { + if (Settings.System.getInt(getActivity().getContentResolver(), + Settings.System.NOTIFICATION_LIGHT_PULSE, 0) == 1) { + mNotificationPulse.setSummary(getString(R.string.notification_light_enabled)); + } else { + mNotificationPulse.setSummary(getString(R.string.notification_light_disabled)); + } + } + + private void updateBatteryPulseDescription() { + if (Settings.System.getInt(getActivity().getContentResolver(), + Settings.System.BATTERY_LIGHT_ENABLED, 1) == 1) { + mBatteryPulse.setSummary(getString(R.string.notification_light_enabled)); + } else { + mBatteryPulse.setSummary(getString(R.string.notification_light_disabled)); + } + } + @Override public void onResume() { super.onResume(); + updateLightPulseDescription(); + updateBatteryPulseDescription(); } @Override |