2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-02 15:15:09 +00:00

Use ArrayUtils' isEmpty() and isNotEmpty().

This commit is contained in:
Isira Seneviratne
2020-07-09 15:23:02 +05:30
committed by Nicolas Fella
parent e74743c684
commit 24efa1968c

View File

@@ -51,6 +51,7 @@ import androidx.fragment.app.DialogFragment;
import org.apache.commons.collections4.MultiValuedMap; import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap; import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.kde.kdeconnect.Helpers.AppsHelper; import org.kde.kdeconnect.Helpers.AppsHelper;
@@ -323,11 +324,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
@Nullable @Nullable
private JSONArray extractActions(Notification notification, String key) { private JSONArray extractActions(Notification notification, String key) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || ArrayUtils.isEmpty(notification.actions)) {
return null;
}
if (notification.actions == null || notification.actions.length == 0) {
return null; return null;
} }
@@ -339,8 +336,8 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
continue; continue;
// Check whether it is a reply action. We have special treatment for them // Check whether it is a reply action. We have special treatment for them
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH &&
if (action.getRemoteInputs() != null && action.getRemoteInputs().length > 0) ArrayUtils.isNotEmpty(action.getRemoteInputs()))
continue; continue;
jsonArray.put(action.title.toString()); jsonArray.put(action.title.toString());