From 24efa1968ca033fea9bebd0344f02d077d99380f Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Thu, 9 Jul 2020 15:23:02 +0530 Subject: [PATCH] Use ArrayUtils' isEmpty() and isNotEmpty(). --- .../NotificationsPlugin/NotificationsPlugin.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java index e244e25f..a45228f4 100644 --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -51,6 +51,7 @@ import androidx.fragment.app.DialogFragment; import org.apache.commons.collections4.MultiValuedMap; import org.apache.commons.collections4.multimap.ArrayListValuedHashMap; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; import org.kde.kdeconnect.Helpers.AppsHelper; @@ -323,11 +324,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. @Nullable private JSONArray extractActions(Notification notification, String key) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - return null; - } - - if (notification.actions == null || notification.actions.length == 0) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || ArrayUtils.isEmpty(notification.actions)) { return null; } @@ -339,9 +336,9 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. continue; // Check whether it is a reply action. We have special treatment for them - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) - if (action.getRemoteInputs() != null && action.getRemoteInputs().length > 0) - continue; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && + ArrayUtils.isNotEmpty(action.getRemoteInputs())) + continue; jsonArray.put(action.title.toString());