use saveActiveSongs and broadcastChangedSongs

in clearQueue and emptyQueue
also, call pause and setFlag before calling emptyQueue
This commit is contained in:
Amin Bandali 2015-04-14 15:32:24 -04:00
parent 7b6fc6218a
commit ddb129b660
2 changed files with 6 additions and 10 deletions

View File

@ -1642,6 +1642,8 @@ public final class PlaybackService extends Service
*/
public void emptyQueue()
{
pause();
setFlag(FLAG_EMPTY_QUEUE);
mTimeline.emptyQueue();
}

View File

@ -774,15 +774,12 @@ public final class SongTimeline {
public void clearQueue()
{
synchronized (this) {
saveActiveSongs();
if (mCurrentPos + 1 < mSongs.size())
mSongs.subList(mCurrentPos + 1, mSongs.size()).clear();
}
if (mCallback != null) {
mCallback.activeSongReplaced(+1, getSong(+1));
mCallback.positionInfoChanged();
}
broadcastChangedSongs();
changed();
}
@ -792,14 +789,11 @@ public final class SongTimeline {
public void emptyQueue()
{
synchronized (this) {
saveActiveSongs();
mSongs.clear();
}
if (mCallback != null) {
mCallback.activeSongReplaced(+1, getSong(+1));
mCallback.positionInfoChanged();
}
broadcastChangedSongs();
changed();
}