implement ability to jump by queue position/id
This commit is contained in:
parent
669bf3f4b8
commit
eda55a01bb
@ -1898,4 +1898,19 @@ public final class PlaybackService extends Service
|
||||
{
|
||||
return mTimeline.getLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 'Song' with given id from timeline
|
||||
*/
|
||||
public Song getSongByQueuePosition(int id) {
|
||||
return mTimeline.getSongByQueuePosition(id);
|
||||
}
|
||||
|
||||
public void jumpToQueuePosition(int id) {
|
||||
pause();
|
||||
mTimeline.setCurrentQueuePosition(id);
|
||||
setCurrentSong(0);
|
||||
play();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -557,7 +557,22 @@ public final class SongTimeline {
|
||||
mCurrentPos = pos;
|
||||
mShuffledSongs = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hard-Jump to given queue position
|
||||
*/
|
||||
public Song setCurrentQueuePosition(int pos) {
|
||||
mCurrentPos = pos;
|
||||
return getSong(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 'Song' at given position in queue
|
||||
*/
|
||||
public Song getSongByQueuePosition(int id) {
|
||||
return mSongs.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move to the next or previous song or album.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user