diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-03-27 21:01:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 21:01:45 +0100 |
commit | 1dbda2fb8a070fb30b4314feca839525cfc701eb (patch) | |
tree | 30b63908a65915e60439353eea493b175fa959ae /storage/database | |
parent | 130da46f5d9c598ca76f4f2127c08bb4ef225b34 (diff) | |
download | AntennaPod-1dbda2fb8a070fb30b4314feca839525cfc701eb.zip |
Split up DBTasks which has unclear responsibilities (#7032)
Diffstat (limited to 'storage/database')
-rw-r--r-- | storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBReader.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBReader.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBReader.java index 89967c24b..f0239d8f5 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBReader.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBReader.java @@ -857,4 +857,28 @@ public final class DBReader { adapter.close(); return result; } + + public static List<FeedItem> searchFeedItems(final long feedId, final String query) { + PodDBAdapter adapter = PodDBAdapter.getInstance().open(); + Cursor searchResult = adapter.searchItems(feedId, query); + List<FeedItem> items = extractItemlistFromCursor(searchResult); + loadAdditionalFeedItemListData(items); + searchResult.close(); + adapter.close(); + return items; + } + + public static List<Feed> searchFeeds(final String query) { + PodDBAdapter adapter = PodDBAdapter.getInstance(); + Cursor cursor = adapter.searchFeeds(query); + List<Feed> items = new ArrayList<>(); + if (cursor.moveToFirst()) { + do { + items.add(FeedCursorMapper.convert(cursor)); + } while (cursor.moveToNext()); + } + cursor.close(); + adapter.close(); + return items; + } } |