aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-03-31 15:26:26 +0200
committersteckbrief <steckbrief@chefmail.de>2015-03-31 15:26:26 +0200
commit6220260df3a97a18baf32e3f4d70596cc1eec563 (patch)
treeb97ef531522aac490cc06715bd8fca7960b96d8a /src/main
parent52ed924a1333448505e83204d3d9b248b2356004 (diff)
Configurable LED color (Attention: Expert setting because currently only text input)
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java11
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/xml/preferences.xml5
3 files changed, 17 insertions, 1 deletions
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 @@
<item quantity="one">%d Kontakt ausgewählt</item>
<item quantity="other">%d Kontakte ausgewählt</item>
</plurals>
+ <string name="pref_led_notification_color">LED-Benachrichtigung Farbe</string>
+ <string name="pref_led_notification_color_summary">Setze die Farbe der LED-Benachrichtigung</string>
</resources>
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" />
+ <EditTextPreference
+ android:defaultValue="0xffffffff"
+ android:key="led_notification_color"
+ android:title="@string/pref_led_notification_color"
+ android:summary="@string/pref_led_notification_color_summary"/>
</PreferenceCategory>
</PreferenceScreen>