Cleaned up MusicServices annotations

This commit is contained in:
Karim Abou Zeid 2015-07-10 22:57:28 +02:00
commit 528d267ab3
2 changed files with 16 additions and 21 deletions

View file

@ -115,7 +115,7 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
* @param context The {@link Context} to use * @param context The {@link Context} to use
* @return A new instance of this class. * @return A new instance of this class.
*/ */
@Nullable @NonNull
public static synchronized MusicPlaybackQueueStore getInstance(@NonNull final Context context) { public static synchronized MusicPlaybackQueueStore getInstance(@NonNull final Context context) {
if (sInstance == null) { if (sInstance == null) {
sInstance = new MusicPlaybackQueueStore(context.getApplicationContext()); sInstance = new MusicPlaybackQueueStore(context.getApplicationContext());

View file

@ -97,11 +97,8 @@ public class MusicService extends Service {
private final IBinder musicBind = new MusicBinder(); private final IBinder musicBind = new MusicBinder();
@Nullable
private MultiPlayer player; private MultiPlayer player;
@Nullable
private ArrayList<Song> playingQueue; private ArrayList<Song> playingQueue;
@Nullable
private ArrayList<Song> originalPlayingQueue; private ArrayList<Song> originalPlayingQueue;
private int position = -1; private int position = -1;
private int nextPosition = -1; private int nextPosition = -1;
@ -118,9 +115,7 @@ public class MusicService extends Service {
private QueueSaveHandler queueSaveHandler; private QueueSaveHandler queueSaveHandler;
private HandlerThread musicPlayerHandlerThread; private HandlerThread musicPlayerHandlerThread;
private HandlerThread queueSaveHandlerThread; private HandlerThread queueSaveHandlerThread;
@Nullable
private RecentlyPlayedStore recentlyPlayedStore; private RecentlyPlayedStore recentlyPlayedStore;
@Nullable
private SongPlayCountStore songPlayCountStore; private SongPlayCountStore songPlayCountStore;
private boolean notNotifiedMetaChangedForCurrentTrack; private boolean notNotifiedMetaChangedForCurrentTrack;
private boolean isServiceInUse; private boolean isServiceInUse;
@ -446,8 +441,13 @@ public class MusicService extends Service {
ImageLoader.getInstance().displayImage(currentAlbumArtUri, new NonViewAware(new ImageSize(-1, -1), ViewScaleType.CROP), new SimpleImageLoadingListener() { ImageLoader.getInstance().displayImage(currentAlbumArtUri, new NonViewAware(new ImageSize(-1, -1), ViewScaleType.CROP), new SimpleImageLoadingListener() {
@Override @Override
public void onLoadingComplete(String imageUri, View view, @Nullable Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, @Nullable Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri)) { if (!currentAlbumArtUri.equals(imageUri)) {
if (loadedImage != null) { return;
}
if (loadedImage == null) {
onLoadingFailed(imageUri, view, null);
return;
}
// RemoteControlClient wants to recycle the bitmaps thrown at it, so we need // RemoteControlClient wants to recycle the bitmaps thrown at it, so we need
// to make sure not to hand out our cache copy // to make sure not to hand out our cache copy
Bitmap.Config config = loadedImage.getConfig(); Bitmap.Config config = loadedImage.getConfig();
@ -456,10 +456,6 @@ public class MusicService extends Service {
} }
loadedImage = loadedImage.copy(config, false); loadedImage = loadedImage.copy(config, false);
updateRemoteControlClientBitmap(loadedImage.copy(loadedImage.getConfig(), true)); updateRemoteControlClientBitmap(loadedImage.copy(loadedImage.getConfig(), true));
} else {
updateRemoteControlClientBitmap(null);
}
}
} }
@Override @Override
@ -537,7 +533,6 @@ public class MusicService extends Service {
return getPosition() == getPlayingQueue().size() - 1; return getPosition() == getPlayingQueue().size() - 1;
} }
@Nullable
public ArrayList<Song> getPlayingQueue() { public ArrayList<Song> getPlayingQueue() {
return playingQueue; return playingQueue;
} }
@ -584,7 +579,7 @@ public class MusicService extends Service {
int restoredPosition = PreferenceManager.getDefaultSharedPreferences(this).getInt(SAVED_POSITION, -1); int restoredPosition = PreferenceManager.getDefaultSharedPreferences(this).getInt(SAVED_POSITION, -1);
int restoredPositionInTrack = PreferenceManager.getDefaultSharedPreferences(this).getInt(SAVED_POSITION_IN_TRACK, -1); int restoredPositionInTrack = PreferenceManager.getDefaultSharedPreferences(this).getInt(SAVED_POSITION_IN_TRACK, -1);
if (restoredQueue != null && restoredOriginalQueue != null && restoredPosition != -1) { if (restoredQueue.size() > 0 && restoredQueue.size() == restoredOriginalQueue.size() && restoredPosition != -1) {
this.originalPlayingQueue = restoredOriginalQueue; this.originalPlayingQueue = restoredOriginalQueue;
this.playingQueue = restoredQueue; this.playingQueue = restoredQueue;