Only trim random songs in addSongs when in random mode

This commit is contained in:
Christopher Eby 2012-03-13 15:45:34 -05:00
parent a00e9b8816
commit e6dd92f3e4

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> * Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -616,14 +616,15 @@ public final class SongTimeline {
switch (mode) { switch (mode) {
case MODE_ENQUEUE: case MODE_ENQUEUE:
case MODE_ENQUEUE_POS_FIRST: case MODE_ENQUEUE_POS_FIRST:
case MODE_ENQUEUE_ID_FIRST: { case MODE_ENQUEUE_ID_FIRST:
int j = timeline.size(); if (mFinishAction == FINISH_RANDOM) {
while (--j > mCurrentPos) { int j = timeline.size();
if (timeline.get(j).isRandom()) while (--j > mCurrentPos) {
timeline.remove(j); if (timeline.get(j).isRandom())
timeline.remove(j);
}
} }
break; break;
}
case MODE_PLAY_NEXT: case MODE_PLAY_NEXT:
timeline.subList(mCurrentPos + 1, timeline.size()).clear(); timeline.subList(mCurrentPos + 1, timeline.size()).clear();
break; break;