Преглед на файлове

Android: Ability to disable notification led (#864)

Alexandre Laurent преди 9 години
родител
ревизия
ec674ea793
променени са 3 файла, в които са добавени 8 реда и са изтрити 4 реда
  1. 6 2
      src/android/notification/Builder.java
  2. 1 1
      src/android/notification/Options.java
  3. 1 1
      www/local-notification-util.js

+ 6 - 2
src/android/notification/Builder.java

@@ -117,6 +117,7 @@ public class Builder {
     public Notification build() {
         Uri sound     = options.getSoundUri();
         int smallIcon = options.getSmallIcon();
+        int ledColor  = options.getLedColor();
         NotificationCompat.Builder builder;
 
         builder = new NotificationCompat.Builder(context)
@@ -127,8 +128,11 @@ public class Builder {
                 .setTicker(options.getText())
                 .setAutoCancel(options.isAutoClear())
                 .setOngoing(options.isOngoing())
-                .setColor(options.getColor())
-                .setLights(options.getLedColor(), 100, 100);
+                .setColor(options.getColor());
+
+        if (ledColor != 0) {
+            builder.setLights(ledColor, 100, 100);
+        }
 
         if (sound != null) {
             builder.setSound(sound);

+ 1 - 1
src/android/notification/Options.java

@@ -242,7 +242,7 @@ public class Options {
         String hex = options.optString("led", null);
 
         if (hex == null) {
-            return NotificationCompat.DEFAULT_LIGHTS;
+            return 0;
         }
 
         int aRGB = Integer.parseInt(hex, 16);

+ 1 - 1
www/local-notification-util.js

@@ -67,7 +67,7 @@ exports.applyPlatformSpecificOptions = function () {
         defaults.smallIcon = undefined;
         defaults.ongoing   = false;
         defaults.autoClear = true;
-        defaults.led       = 'FF0000';
+        defaults.led       = undefined;
         defaults.color     = undefined;
         break;
     }