From 6220260df3a97a18baf32e3f4d70596cc1eec563 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Tue, 31 Mar 2015 15:26:26 +0200 Subject: Configurable LED color (Attention: Expert setting because currently only text input) --- .../eu/siacs/conversations/services/NotificationService.java | 11 ++++++++++- src/main/res/values-de/strings.xml | 2 ++ src/main/res/xml/preferences.xml | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 7269a559..fa079829 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -215,12 +215,21 @@ public class NotificationService { mBuilder.setDefaults(0); mBuilder.setSmallIcon(R.drawable.ic_notification); mBuilder.setDeleteIntent(createDeleteIntent()); - mBuilder.setLights(0xff00FF00, 2000, 3000); + mBuilder.setLights(this.getLedNotificationColor(preferences), 2000, 4000); final Notification notification = mBuilder.build(); notificationManager.notify(NOTIFICATION_ID, notification); } } + private int getLedNotificationColor(SharedPreferences preferences) { + String ledColorString = preferences.getString("led_notification_color", "0xffffffff"); + try { + return Integer.valueOf(ledColorString); + } catch (NumberFormatException e) { + return 0xffffffff; + } + } + private Builder buildMultipleConversation() { final Builder mBuilder = new NotificationCompat.Builder( mXmppConnectionService); diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 44a7efb2..14e5b091 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -433,4 +433,6 @@ %d Kontakt ausgewählt %d Kontakte ausgewählt + LED-Benachrichtigung Farbe + Setze die Farbe der LED-Benachrichtigung diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index d055f573..adc15c6f 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -151,6 +151,11 @@ android:key="keep_foreground_service" android:title="@string/pref_keep_foreground_service" android:summary="@string/pref_keep_foreground_service_summary" /> + -- cgit v1.2.3