Skip to content

Commit 08489b8

Browse files
authored
Merge pull request #7220 from TeamNewPipe/code-improvements
Simplify code and add annotations
2 parents e0ba9b3 + 658d988 commit 08489b8

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ public Single<List<StreamStateEntity>> loadStreamStateBatch(final List<InfoItem>
334334
.getState(entities.get(0).getUid()).blockingFirst();
335335
if (states.isEmpty()) {
336336
result.add(null);
337-
continue;
337+
} else {
338+
result.add(states.get(0));
338339
}
339-
result.add(states.get(0));
340340
}
341341
return result;
342342
}).subscribeOn(Schedulers.io());
@@ -362,9 +362,9 @@ public Single<List<StreamStateEntity>> loadLocalStreamStateBatch(
362362
.blockingFirst();
363363
if (states.isEmpty()) {
364364
result.add(null);
365-
continue;
365+
} else {
366+
result.add(states.get(0));
366367
}
367-
result.add(states.get(0));
368368
}
369369
return result;
370370
}).subscribeOn(Schedulers.io());

app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ private boolean checkIfMetadataShouldBeSet(
179179
// If we got an album art check if the current set AlbumArt is null
180180
if (optAlbumArt.isPresent() && getMetadataAlbumArt() == null) {
181181
if (DEBUG) {
182-
if (getMetadataAlbumArt() == null) {
183-
Log.d(TAG, "N_getMetadataAlbumArt: thumb == null");
184-
}
182+
Log.d(TAG, "N_getMetadataAlbumArt: thumb == null");
185183
}
186184
return true;
187185
}
@@ -191,16 +189,19 @@ private boolean checkIfMetadataShouldBeSet(
191189
}
192190

193191

192+
@Nullable
194193
private Bitmap getMetadataAlbumArt() {
195194
return mediaSession.getController().getMetadata()
196195
.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART);
197196
}
198197

198+
@Nullable
199199
private String getMetadataTitle() {
200200
return mediaSession.getController().getMetadata()
201201
.getString(MediaMetadataCompat.METADATA_KEY_TITLE);
202202
}
203203

204+
@Nullable
204205
private String getMetadataArtist() {
205206
return mediaSession.getController().getMetadata()
206207
.getString(MediaMetadataCompat.METADATA_KEY_ARTIST);

0 commit comments

Comments
 (0)