Fixed a lot of possible issues raised by a code inspection

This commit is contained in:
CappielloAntonio
2021-09-04 16:14:10 +02:00
parent 39ff821aee
commit 042bf3077f
76 changed files with 148 additions and 225 deletions

View File

@@ -1,5 +1,7 @@
package com.cappielloantonio.play.service;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import android.content.Context;
import android.net.Uri;
@@ -7,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.DownloadRepository;
import com.cappielloantonio.play.util.MappingUtil;
@@ -29,8 +30,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
public class DownloadTracker {
private static final String TAG = "DownloadTracker";
@@ -74,7 +73,7 @@ public class DownloadTracker {
MediaItem mediaItem = MusicUtil.getMediaItemFromSong(song);
@Nullable Download download = downloads.get(checkNotNull(mediaItem.playbackProperties).uri);
if(download != null && download.state != Download.STATE_FAILED) {
if (download != null && download.state != Download.STATE_FAILED) {
return true;
}
}
@@ -91,7 +90,7 @@ public class DownloadTracker {
DownloadRepository downloadRepository = new DownloadRepository(App.getInstance());
for (Song song : songs) {
if(isDownloaded(song)) {
if (isDownloaded(song)) {
downloadRepository.insert(MappingUtil.mapToDownload(song, playlistId, playlistName));
continue;
}