Feed item filter: Load queue ids only once
This commit is contained in:
parent
45448404a1
commit
6f8916e58c
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
|
|
||||||
public class FeedItemFilter {
|
public class FeedItemFilter {
|
||||||
private final String[] mProperties;
|
private final String[] mProperties;
|
||||||
|
@ -66,13 +67,14 @@ public class FeedItemFilter {
|
||||||
if (showQueued && showNotQueued) return result;
|
if (showQueued && showNotQueued) return result;
|
||||||
if (showDownloaded && showNotDownloaded) return result;
|
if (showDownloaded && showNotDownloaded) return result;
|
||||||
|
|
||||||
|
final LongList queuedIds = DBReader.getQueueIDList();
|
||||||
for(FeedItem item : items) {
|
for(FeedItem item : items) {
|
||||||
// If the item does not meet a requirement, skip it.
|
// If the item does not meet a requirement, skip it.
|
||||||
if (showPlayed && !item.isPlayed()) continue;
|
if (showPlayed && !item.isPlayed()) continue;
|
||||||
if (showUnplayed && item.isPlayed()) continue;
|
if (showUnplayed && item.isPlayed()) continue;
|
||||||
if (showPaused && item.getState() != FeedItem.State.IN_PROGRESS) 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 (showQueued && !queued) continue;
|
||||||
if (showNotQueued && queued) continue;
|
if (showNotQueued && queued) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue