Reformatted MediaSessionManager code

This commit is contained in:
litetex 2021-09-24 23:55:06 +02:00
parent c0d41661e8
commit ba0876b43b
1 changed files with 31 additions and 24 deletions

View File

@ -93,7 +93,13 @@ public class MediaSessionManager {
return;
}
if (checkIfMetadataShouldBeSet(title, artist, optAlbumArt, duration)) {
if (!checkIfMetadataShouldBeSet(title, artist, optAlbumArt, duration)) {
if (DEBUG) {
Log.d(TAG, "setMetadata: No update required");
}
return;
}
if (DEBUG) {
Log.d(TAG, "setMetadata: N_Metadata update:"
+ " t: " + title
@ -124,7 +130,6 @@ public class MediaSessionManager {
lastAlbumArtHashCode = optAlbumArt.get().hashCode();
}
}
}
private boolean checkIfMetadataShouldBeSet(
@NonNull final String title,
@ -144,6 +149,7 @@ public class MediaSessionManager {
}
return true;
}
// Check if the current metadata is valid
if (getMetadataTitle() == null
|| getMetadataArtist() == null
@ -163,6 +169,7 @@ public class MediaSessionManager {
}
return true;
}
// If we got an album art check if the current set AlbumArt is null
if (optAlbumArt.isPresent() && getMetadataAlbumArt() == null) {
if (DEBUG) {