Преглед изворни кода

Restore Java 1.6 compatibility [fixes #1500]

Sebastián Katzer пре 8 година
родитељ
комит
bf57b0959c

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

@@ -45,7 +45,6 @@ import static de.appplant.cordova.plugin.notification.Notification.EXTRA_UPDATE;
  * Builder class for local notifications. Build fully configured local
  * notification specified by JSON object passed from JS side.
  */
-@SuppressWarnings("Convert2Diamond")
 public final class Builder {
 
     // Application context passed by constructor

+ 0 - 1
src/android/notification/Manager.java

@@ -50,7 +50,6 @@ import static de.appplant.cordova.plugin.notification.Notification.Type.TRIGGERE
  * state like triggered or scheduled. Offers shortcut ways to schedule,
  * cancel or clear local notifications.
  */
-@SuppressWarnings("Convert2Diamond")
 public final class Manager {
 
     // TODO: temporary

+ 4 - 3
src/android/notification/Notification.java

@@ -56,7 +56,6 @@ import static android.support.v4.app.NotificationManagerCompat.IMPORTANCE_MIN;
  * Wrapper class around OS notification class. Handles basic operations
  * like show, delete, cancel for a single local notification instance.
  */
-@SuppressWarnings("Convert2Diamond")
 public final class Notification {
 
     // Used to differ notifications by their life cycle state
@@ -77,7 +76,7 @@ public final class Notification {
     private static final String PREF_KEY_PID = "NOTIFICATION_PID";
 
     // Cache for the builder instances
-    static SparseArray<NotificationCompat.Builder> cache = null;
+    private static SparseArray<NotificationCompat.Builder> cache = null;
 
     // Application context passed by constructor
     private final Context context;
@@ -246,7 +245,9 @@ public final class Notification {
 
         try {
             receiver = (BroadcastReceiver) cls.newInstance();
-        } catch (InstantiationException | IllegalAccessException e) {
+        } catch (InstantiationException e) {
+            return false;
+        } catch (IllegalAccessException e) {
             return false;
         }
 

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

@@ -54,7 +54,6 @@ import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET;
  * possible option values. Class provides simple readers and more advanced
  * methods to convert independent values into platform specific values.
  */
-@SuppressWarnings("Convert2Diamond")
 public final class Options {
 
     // Key name for bundled sound extra
@@ -322,7 +321,11 @@ public final class Options {
 
             int aRGB = Integer.parseInt(hex, 16);
             return aRGB + 0xFF000000;
-        } catch (NumberFormatException | NoSuchFieldException | IllegalAccessException e) {
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+        } catch (NoSuchFieldException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
             e.printStackTrace();
         }