implement ability to jump by queue position/id

This commit is contained in:
Adrian Ulrich committed 2012-09-29 20:14:48 +02:00
1 parent 669bf3f4b8
commit eda55a01bb
2 files changed
+31 -1

No files matched your search

@@ -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.
*