allow passing 0 to timelines shiftCurrentSong
This commit is contained in:
parent
0cfd1c905c
commit
cce1727b8b
@ -1273,11 +1273,7 @@ public final class PlaybackService extends Service
|
||||
if (mMediaPlayer.isPlaying())
|
||||
mMediaPlayer.stop();
|
||||
|
||||
Song song;
|
||||
if (delta == 0)
|
||||
song = mTimeline.getSong(0);
|
||||
else
|
||||
song = mTimeline.shiftCurrentSong(delta);
|
||||
Song song = mTimeline.shiftCurrentSong(delta);
|
||||
mCurrentSong = song;
|
||||
if (song == null) {
|
||||
if (MediaUtils.isSongAvailable(getContentResolver())) {
|
||||
|
@ -199,6 +199,11 @@ public final class SongTimeline {
|
||||
* @see SongTimeline#shiftCurrentSong(int)
|
||||
*/
|
||||
public static final int SHIFT_PREVIOUS_SONG = -1;
|
||||
/**
|
||||
* Noop
|
||||
* @see SongTimeline#shiftCurrentSong(int)
|
||||
*/
|
||||
public static final int SHIFT_KEEP_SONG = 0;
|
||||
/**
|
||||
* Move current position to the next song.
|
||||
*
|
||||
@ -650,7 +655,10 @@ public final class SongTimeline {
|
||||
public Song shiftCurrentSong(int delta)
|
||||
{
|
||||
synchronized (this) {
|
||||
if (delta == SHIFT_PREVIOUS_SONG || delta == SHIFT_NEXT_SONG) {
|
||||
if (delta == SHIFT_KEEP_SONG) {
|
||||
// void
|
||||
}
|
||||
else if (delta == SHIFT_PREVIOUS_SONG || delta == SHIFT_NEXT_SONG) {
|
||||
shiftCurrentSongInternal(delta);
|
||||
} else {
|
||||
Song song = getSong(0);
|
||||
@ -663,7 +671,9 @@ public final class SongTimeline {
|
||||
} while (currentAlbum == song.albumId && currentSong != song.id);
|
||||
}
|
||||
}
|
||||
changed();
|
||||
|
||||
if (delta != SHIFT_KEEP_SONG)
|
||||
changed();
|
||||
return getSong(0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user