Feed item filter: Load queue ids only once

This commit is contained in:
Martin Fietz 2016-05-28 13:17:51 +02:00
parent 1048735327
commit 8c0d350738
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.LongList;
public class FeedItemFilter {
private final String[] mProperties;
@ -66,13 +67,14 @@ public class FeedItemFilter {
if (showQueued && showNotQueued) return result;
if (showDownloaded && showNotDownloaded) return result;
final LongList queuedIds = DBReader.getQueueIDList();
for(FeedItem item : items) {
// If the item does not meet a requirement, skip it.
if (showPlayed && !item.isPlayed()) continue;
if (showUnplayed && item.isPlayed()) continue;
if (showPaused && item.getState() != FeedItem.State.IN_PROGRESS) continue;
boolean queued = DBReader.getQueueIDList().contains(item.getId());
boolean queued = queuedIds.contains(item.getId());
if (showQueued && !queued) continue;
if (showNotQueued && queued) continue;