Currently playing item cannot be removed from the queue any longer

This commit is contained in:
daniel oeh 2013-03-24 12:47:03 +01:00
parent 2bcb1df73a
commit 80206b19a8
2 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@ -890,7 +891,17 @@ public class FeedManager {
public void clearQueue(final Context context) {
if (AppConfig.DEBUG)
Log.d(TAG, "Clearing queue");
queue.clear();
Iterator<FeedItem> iter = queue.iterator();
while (iter.hasNext()) {
FeedItem item = iter.next();
if (item.getState() != FeedItem.State.PLAYING) {
iter.remove();
} else {
if (AppConfig.DEBUG)
Log.d(TAG,
"FeedItem is playing and is therefore not removed from the queue");
}
}
eventDist.sendQueueUpdateBroadcast();
dbExec.execute(new Runnable() {

View File

@ -80,7 +80,7 @@ public class FeedItemMenuHandler {
}
boolean isInQueue = manager.isInQueue(selectedItem);
if (!isInQueue) {
if (!isInQueue || isPlaying) {
mi.setItemVisibility(R.id.remove_from_queue_item, false);
}
if (!(!isInQueue && selectedItem.getMedia() != null)) {