diff options
Diffstat (limited to 'storage')
-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; + } } |