introduced setting to turn of notification led

This commit is contained in:
Daniel Gultsch 2016-04-09 21:48:06 +02:00
parent 4652541b61
commit 83fab06508
3 changed files with 15 additions and 5 deletions

View file

@ -180,6 +180,7 @@ public class NotificationService {
final String ringtone = preferences.getString("notification_ringtone", null); final String ringtone = preferences.getString("notification_ringtone", null);
final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true); final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true);
final boolean led = preferences.getBoolean("led", true);
if (notifications.size() == 0) { if (notifications.size() == 0) {
notificationManager.cancel(NOTIFICATION_ID); notificationManager.cancel(NOTIFICATION_ID);
@ -210,7 +211,9 @@ public class NotificationService {
mBuilder.setDefaults(0); mBuilder.setDefaults(0);
mBuilder.setSmallIcon(R.drawable.ic_notification); mBuilder.setSmallIcon(R.drawable.ic_notification);
mBuilder.setDeleteIntent(createDeleteIntent()); mBuilder.setDeleteIntent(createDeleteIntent());
if (led) {
mBuilder.setLights(0xff00FF00, 2000, 3000); mBuilder.setLights(0xff00FF00, 2000, 3000);
}
final Notification notification = mBuilder.build(); final Notification notification = mBuilder.build();
notificationManager.notify(NOTIFICATION_ID, notification); notificationManager.notify(NOTIFICATION_ID, notification);
} }

View file

@ -108,9 +108,11 @@
<string name="pref_notifications">Notifications</string> <string name="pref_notifications">Notifications</string>
<string name="pref_notifications_summary">Notify when a new message arrives</string> <string name="pref_notifications_summary">Notify when a new message arrives</string>
<string name="pref_vibrate">Vibrate</string> <string name="pref_vibrate">Vibrate</string>
<string name="pref_vibrate_summary">Also vibrate when a new message arrives</string> <string name="pref_vibrate_summary">Vibrate when a new message arrives</string>
<string name="pref_sound">Sound</string> <string name="pref_led">LED Notification</string>
<string name="pref_sound_summary">Play ringtone with notification</string> <string name="pref_led_summary">Blink notification light when a new message arrives</string>
<string name="pref_sound">Ringtone</string>
<string name="pref_sound_summary">Play sound when a new message arrives</string>
<string name="pref_notification_grace_period">Notification grace period</string> <string name="pref_notification_grace_period">Notification grace period</string>
<string name="pref_notification_grace_period_summary">Disable notifications for a short time after a carbon copy was received</string> <string name="pref_notification_grace_period_summary">Disable notifications for a short time after a carbon copy was received</string>
<string name="pref_advanced_options">Advanced</string> <string name="pref_advanced_options">Advanced</string>

View file

@ -79,7 +79,12 @@
android:key="vibrate_on_notification" android:key="vibrate_on_notification"
android:summary="@string/pref_vibrate_summary" android:summary="@string/pref_vibrate_summary"
android:title="@string/pref_vibrate"/> android:title="@string/pref_vibrate"/>
<CheckBoxPreference
android:defaultValue="true"
android:dependency="show_notification"
android:key="led"
android:title="@string/pref_led"
android:summary="@string/pref_led_summary"/>
<RingtonePreference <RingtonePreference
android:defaultValue="content://settings/system/notification_sound" android:defaultValue="content://settings/system/notification_sound"
android:dependency="show_notification" android:dependency="show_notification"