From 658d9882544dd15cd2156dda1734b18fedc6f3ce Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 10 Oct 2021 20:30:56 +0200 Subject: [PATCH] Simplify code and add annotations --- .../newpipe/local/history/HistoryRecordManager.java | 8 ++++---- .../schabi/newpipe/player/helper/MediaSessionManager.java | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java b/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java index 823e56d9e..d8c8440e2 100644 --- a/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java +++ b/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java @@ -334,9 +334,9 @@ public class HistoryRecordManager { .getState(entities.get(0).getUid()).blockingFirst(); if (states.isEmpty()) { result.add(null); - continue; + } else { + result.add(states.get(0)); } - result.add(states.get(0)); } return result; }).subscribeOn(Schedulers.io()); @@ -362,9 +362,9 @@ public class HistoryRecordManager { .blockingFirst(); if (states.isEmpty()) { result.add(null); - continue; + } else { + result.add(states.get(0)); } - result.add(states.get(0)); } return result; }).subscribeOn(Schedulers.io()); diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java index ef0d84029..8d344c877 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java @@ -179,9 +179,7 @@ public class MediaSessionManager { // If we got an album art check if the current set AlbumArt is null if (optAlbumArt.isPresent() && getMetadataAlbumArt() == null) { if (DEBUG) { - if (getMetadataAlbumArt() == null) { - Log.d(TAG, "N_getMetadataAlbumArt: thumb == null"); - } + Log.d(TAG, "N_getMetadataAlbumArt: thumb == null"); } return true; } @@ -191,16 +189,19 @@ public class MediaSessionManager { } + @Nullable private Bitmap getMetadataAlbumArt() { return mediaSession.getController().getMetadata() .getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART); } + @Nullable private String getMetadataTitle() { return mediaSession.getController().getMetadata() .getString(MediaMetadataCompat.METADATA_KEY_TITLE); } + @Nullable private String getMetadataArtist() { return mediaSession.getController().getMetadata() .getString(MediaMetadataCompat.METADATA_KEY_ARTIST);