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;
}

View file

@ -6,12 +6,8 @@ import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Handler;
import android.os.HandlerThread;
@ -32,7 +28,6 @@ import com.cappielloantonio.play.R;
import com.cappielloantonio.play.broadcast.receiver.MediaButtonIntentReceiver;
import com.cappielloantonio.play.interfaces.Playback;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.QueueRepository;
import com.cappielloantonio.play.repository.SongRepository;