diff options
| -rw-r--r-- | res/values/cm_strings.xml | 2 | ||||
| -rw-r--r-- | res/xml/notification_light_settings.xml | 8 | ||||
| -rw-r--r-- | src/com/android/settings/notificationlight/NotificationLightSettings.java | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 97abadd9c..8d0335fd4 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -309,7 +309,9 @@ <string name="notification_light_default_value">Default</string> <string name="notification_light_missed_call_title">Missed call</string> <string name="notification_light_voicemail_title">Voicemail</string> + <string name="notification_light_brightness" translatable="false">@string/brightness</string> <string name="notification_light_screen_on">Lights with screen on</string> + <string name="keywords_lights_brightness_level">dim leds brightness</string> <!-- Lights settings, LED notification --> <string name="led_notification_title">Light settings</string> diff --git a/res/xml/notification_light_settings.xml b/res/xml/notification_light_settings.xml index 7c44da7a5..4737097ae 100644 --- a/res/xml/notification_light_settings.xml +++ b/res/xml/notification_light_settings.xml @@ -37,6 +37,14 @@ android:key="advanced_section" android:title="@string/notification_light_advanced_title"> + <PreferenceScreen + android:key="notification_light_brightness_level" + android:title="@string/notification_light_brightness" + android:dependency="notification_light_pulse" + settings:keywords="@string/keywords_lights_brightness_level"> + <intent android:action="android.intent.action.SHOW_NOTIFICATION_BRIGHTNESS_DIALOG" /> + </PreferenceScreen> + <com.android.settings.cyanogenmod.CMSystemSettingSwitchPreference android:key="notification_light_screen_on_enable" android:title="@string/notification_light_screen_on" 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 { |
