瀏覽代碼

Fix lint warnings

Sebastián Katzer 8 年之前
父節點
當前提交
978c5550f6

+ 4 - 0
src/android/notification/receiver/AbstractClearReceiver.java

@@ -44,6 +44,10 @@ abstract public class AbstractClearReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(Context context, Intent intent) {
         Bundle bundle      = intent.getExtras();
+
+        if (bundle == null)
+            return;
+
         int toastId        = bundle.getInt(Notification.EXTRA_ID);
         Notification toast = Manager.getInstance(context).get(toastId);
 

+ 7 - 0
src/android/notification/receiver/AbstractClickReceiver.java

@@ -52,6 +52,10 @@ abstract public class AbstractClickReceiver extends Activity {
         Intent intent      = getIntent();
         Bundle bundle      = intent.getExtras();
         Context context    = getApplicationContext();
+
+        if (bundle == null)
+            return;
+
         int toastId        = bundle.getInt(Notification.EXTRA_ID);
         Notification toast = Manager.getInstance(context).get(toastId);
 
@@ -97,6 +101,9 @@ abstract public class AbstractClickReceiver extends Activity {
                 .getPackageManager()
                 .getLaunchIntentForPackage(pkgName);
 
+        if (intent == null)
+            return;
+
         intent.addFlags(
                 FLAG_ACTIVITY_REORDER_TO_FRONT | FLAG_ACTIVITY_SINGLE_TOP);
 

+ 5 - 1
src/android/notification/receiver/AbstractTriggerReceiver.java

@@ -46,7 +46,11 @@ abstract public class AbstractTriggerReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(Context context, Intent intent) {
         Bundle bundle   = intent.getExtras();
-        int toastId     = bundle.getInt(Notification.EXTRA_ID);
+
+        if (bundle == null)
+            return;
+
+        int toastId     = bundle.getInt(Notification.EXTRA_ID, 0);
         Options options = Manager.getInstance(context).getOptions(toastId);
 
         if (options == null)

+ 1 - 5
src/android/notification/trigger/IntervalTrigger.java

@@ -68,10 +68,8 @@ public class IntervalTrigger extends DateTrigger {
      * Adds the amount of ticks to the calendar.
      *
      * @param cal The calendar to manipulate.
-     *
-     * @return The calendar instance.
      */
-    Calendar addInterval(Calendar cal) {
+    void addInterval(Calendar cal) {
         switch (unit) {
             case SECOND:
                 cal.add(Calendar.SECOND, ticks);
@@ -98,8 +96,6 @@ public class IntervalTrigger extends DateTrigger {
                 cal.add(Calendar.YEAR, ticks);
                 break;
         }
-
-        return cal;
     }
 
 }