diff options
author | mueller-ma <mueller-ma@users.noreply.github.com> | 2023-05-05 17:22:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 17:22:31 +0200 |
commit | aab19f3a5c35a30847cf6b3f50680a0269e795df (patch) | |
tree | 232aa0c7b1673ae64055608f0b90acdf208570e7 /core | |
parent | e2bbc3ef17687cfaa4c6a02507ed1cfd77665d37 (diff) | |
download | AntennaPod-aab19f3a5c35a30847cf6b3f50680a0269e795df.zip |
Ignore subscription filter when suggesting tags (#6453)
I have the following setup:
* A tag 'Done' with fully listened podcasts
* The subscription filter "counter greater 0"
* The subscription counter "downloaded episodes"
This way all done podcasts aren't visible in the drawer. When I want to
tag another podcast as done, 'Done' isn't auto-completed. With this
change all tags will be auto-completed.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java | 28 | ||||
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java | 4 |
2 files changed, 18 insertions, 14 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 4a2c6148a..94a7334f3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -1,11 +1,12 @@ package de.danoeh.antennapod.core.storage; import android.database.Cursor; +import android.text.TextUtils; +import android.util.Log; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.collection.ArrayMap; -import android.text.TextUtils; -import android.util.Log; import java.util.ArrayList; import java.util.Collections; @@ -14,6 +15,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import de.danoeh.antennapod.core.util.LongList; +import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator; +import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; +import de.danoeh.antennapod.core.util.comparator.PlaybackCompletionDateComparator; +import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; @@ -22,19 +28,14 @@ import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.model.feed.SubscriptionsFilter; -import de.danoeh.antennapod.storage.preferences.UserPreferences; -import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.storage.database.PodDBAdapter; -import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper; import de.danoeh.antennapod.storage.database.mapper.ChapterCursorMapper; +import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper; import de.danoeh.antennapod.storage.database.mapper.FeedCursorMapper; import de.danoeh.antennapod.storage.database.mapper.FeedItemCursorMapper; import de.danoeh.antennapod.storage.database.mapper.FeedMediaCursorMapper; import de.danoeh.antennapod.storage.database.mapper.FeedPreferencesCursorMapper; -import de.danoeh.antennapod.core.util.LongList; -import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator; -import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; -import de.danoeh.antennapod.core.util.comparator.PlaybackCompletionDateComparator; +import de.danoeh.antennapod.storage.preferences.UserPreferences; /** * Provides methods for reading data from the AntennaPod database. @@ -811,14 +812,17 @@ public final class DBReader { * items. */ @NonNull - public static NavDrawerData getNavDrawerData() { + public static NavDrawerData getNavDrawerData(@Nullable SubscriptionsFilter subscriptionsFilter) { Log.d(TAG, "getNavDrawerData() called with: " + ""); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); final Map<Long, Integer> feedCounters = adapter.getFeedCounters(UserPreferences.getFeedCounterSetting()); - SubscriptionsFilter subscriptionsFilter = UserPreferences.getSubscriptionsFilter(); - List<Feed> feeds = subscriptionsFilter.filter(getFeedList(adapter), feedCounters); + List<Feed> feeds = getFeedList(adapter); + + if (subscriptionsFilter != null) { + feeds = subscriptionsFilter.filter(feeds, feedCounters); + } Comparator<Feed> comparator; int feedOrder = UserPreferences.getFeedOrder(); diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java index 3fadf7528..b67bc48ea 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java @@ -330,7 +330,7 @@ public class DbReaderTest { final int numFeeds = 10; final int numItems = 10; DbTestUtils.saveFeedlist(numFeeds, numItems, true); - NavDrawerData navDrawerData = DBReader.getNavDrawerData(); + NavDrawerData navDrawerData = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter()); assertEquals(numFeeds, navDrawerData.items.size()); assertEquals(0, navDrawerData.numNewItems); assertEquals(0, navDrawerData.queueSize); @@ -359,7 +359,7 @@ public class DbReaderTest { adapter.close(); - NavDrawerData navDrawerData = DBReader.getNavDrawerData(); + NavDrawerData navDrawerData = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter()); assertEquals(numFeeds, navDrawerData.items.size()); assertEquals(numNew, navDrawerData.numNewItems); assertEquals(numQueue, navDrawerData.queueSize); |