Ver Fonte

Use system default LED color in case of

Sebastián Katzer há 10 anos atrás
pai
commit
810ff01522

+ 1 - 5
src/android/notification/Builder.java

@@ -128,11 +128,7 @@ public class Builder {
                 .setAutoCancel(options.isAutoClear())
                 .setOngoing(options.isOngoing())
                 .setColor(options.getColor())
-                .setLights(options.getLedColor(), 500, 500);
-
-        if (sound != null) {
-            builder.setSound(sound);
-        }
+                .setLights(options.getLedColor(), 100, 100);
 
         if (sound != null) {
             builder.setSound(sound);

+ 8 - 5
src/android/notification/Options.java

@@ -242,12 +242,15 @@ public class Options {
      *      The notification color for LED
      */
     public int getLedColor() {
-        String hex = options.optString("led", "000000");
-        int aRGB   = Integer.parseInt(hex,16);
+        String hex = options.optString("led", null);
 
-        aRGB += 0xFF000000;
+        if (hex == null) {
+            return NotificationCompat.DEFAULT_LIGHTS;
+        }
 
-        return aRGB;
+        int aRGB = Integer.parseInt(hex, 16);
+
+        return aRGB + 0xFF000000;
     }
 
     /**
@@ -255,7 +258,7 @@ public class Options {
      *      The notification background color for the small icon
      *      Returns null, if no color is given.
      */
-    public Integer getColor() {
+    public int getColor() {
         String hex = options.optString("color", null);
 
         if (hex == null) {