OSDN Git Service

Reset next Track in Apollo on QUEUE_CHANGED
authorHendrik Borghorst <hendrikborghorst@gmail.com>
Wed, 14 Aug 2013 18:26:32 +0000 (20:26 +0200)
committerHendrik Borghorst <hendrikborghorst@gmail.com>
Fri, 16 Aug 2013 10:20:03 +0000 (12:20 +0200)
If you change the queue for the next track mediaplayer don't gets reinitialized.

This means the next song which is played is actually the one queued before change of queue.

PS2: Only setNextTrack if Service is actually playing at the moment.
PS3: Whitespace fix
PS4: Remove last track in queue case included. Space fixed

Change-Id: I9ddd762d3c42815e7b365f6a5c4b124f5d940a5a

src/com/andrew/apollo/MusicPlaybackService.java

index de28f89..b45d509 100644 (file)
@@ -1171,6 +1171,8 @@ public class MusicPlaybackService extends Service {
         if (mNextPlayPos >= 0 && mPlayList != null) {
             final long id = mPlayList[mNextPlayPos];
             mPlayer.setNextDataSource(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + "/" + id);
+        } else {
+            mPlayer.setNextDataSource(null);
         }
     }
 
@@ -1316,6 +1318,9 @@ public class MusicPlaybackService extends Service {
                     MusicUtils.getReleaseDateForAlbum(this, getAlbumId()));
         } else if (what.equals(QUEUE_CHANGED)) {
             saveQueue(true);
+            if (isPlaying()) {
+                setNextTrack();
+            }
         } else {
             saveQueue(false);
         }