diff options
| author | AdrianDC <radian.dc@gmail.com> | 2015-08-18 19:18:49 +0200 |
|---|---|---|
| committer | Adnan Begovic <adnan@cyngn.com> | 2015-11-16 11:51:53 -0800 |
| commit | e0eac298ca46ee5fef7dca5d6d126c8cb4b5ac42 (patch) | |
| tree | bdfc3e472652c5247c7ec669960b31d99a9e5e82 /src/com/android/settings/notificationlight | |
| parent | 0fdd542dd7857ed5e996d2176cd801763ae7605f (diff) | |
| download | packages_apps_Settings-e0eac298ca46ee5fef7dca5d6d126c8cb4b5ac42.tar.gz packages_apps_Settings-e0eac298ca46ee5fef7dca5d6d126c8cb4b5ac42.tar.bz2 packages_apps_Settings-e0eac298ca46ee5fef7dca5d6d126c8cb4b5ac42.zip | |
LEDs Brightness [1/2]: Lights notifications brightness support
Implement the support of an overall brightness control for the LEDs.
The setting is deactivated by default
and will be ignored by the unimplemented phones.
Current LibLights will simply not use the new variable.
Changes includes :
frameworks/base
packages/apps/Settings
Change-Id: I6ff14ee0de8200f211302a868c5b43e3ec6f9f3a
Signed-off-by: AdrianDC <radian.dc@gmail.com>
Diffstat (limited to 'src/com/android/settings/notificationlight')
| -rw-r--r-- | src/com/android/settings/notificationlight/NotificationLightSettings.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/settings/notificationlight/NotificationLightSettings.java b/src/com/android/settings/notificationlight/NotificationLightSettings.java index cc6ee6ba0..eb0912f37 100644 --- a/src/com/android/settings/notificationlight/NotificationLightSettings.java +++ b/src/com/android/settings/notificationlight/NotificationLightSettings.java @@ -67,12 +67,14 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem private static final int MENU_ADD = 0; private static final int DIALOG_APPS = 0; + private boolean mAdjustableNotificationLedBrightness; private boolean mMultiColorNotificationLed; private int mDefaultColor; private int mDefaultLedOn; private int mDefaultLedOff; private PackageManager mPackageManager; private PreferenceGroup mApplicationPrefList; + private PreferenceScreen mNotificationLedBrightnessPref; private SystemSettingSwitchPreference mEnabledPref; private CMSystemSettingSwitchPreference mCustomEnabledPref; private CMSystemSettingSwitchPreference mScreenOnLightsPref; @@ -96,6 +98,8 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem PreferenceGroup mAdvancedPrefs = (PreferenceGroup) prefSet.findPreference("advanced_section"); PreferenceGroup mPhonePrefs = (PreferenceGroup) prefSet.findPreference("phone_list"); + mAdjustableNotificationLedBrightness = resources.getBoolean( + org.cyanogenmod.platform.internal.R.bool.config_adjustableNotificationLedBrightness); mMultiColorNotificationLed = resources.getBoolean( com.android.internal.R.bool.config_multiColorNotificationLed); @@ -119,12 +123,19 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem mDefaultPref.setOnPreferenceChangeListener(this); // Advanced light settings + mNotificationLedBrightnessPref = (PreferenceScreen) + findPreference(CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL); mScreenOnLightsPref = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_SCREEN_ON); mScreenOnLightsPref.setOnPreferenceChangeListener(this); mCustomEnabledPref = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE); mCustomEnabledPref.setOnPreferenceChangeListener(this); + if (!mAdjustableNotificationLedBrightness) { + mAdvancedPrefs.removePreference(mNotificationLedBrightnessPref); + } else { + mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this); + } // Missed call and Voicemail preferences should only show on devices with a voice capabilities TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); @@ -413,6 +424,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem public boolean onPreferenceChange(Preference preference, Object objValue) { if (preference == mEnabledPref || preference == mCustomEnabledPref || + preference == mNotificationLedBrightnessPref || preference == mScreenOnLightsPref) { getActivity().invalidateOptionsMenu(); } else { |
