From 1dbda2fb8a070fb30b4314feca839525cfc701eb Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 27 Mar 2024 21:01:45 +0100 Subject: Split up DBTasks which has unclear responsibilities (#7032) --- .../antennapod/storage/database/DBReader.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'storage/database') 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 searchFeedItems(final long feedId, final String query) { + PodDBAdapter adapter = PodDBAdapter.getInstance().open(); + Cursor searchResult = adapter.searchItems(feedId, query); + List items = extractItemlistFromCursor(searchResult); + loadAdditionalFeedItemListData(items); + searchResult.close(); + adapter.close(); + return items; + } + + public static List searchFeeds(final String query) { + PodDBAdapter adapter = PodDBAdapter.getInstance(); + Cursor cursor = adapter.searchFeeds(query); + List items = new ArrayList<>(); + if (cursor.moveToFirst()) { + do { + items.add(FeedCursorMapper.convert(cursor)); + } while (cursor.moveToNext()); + } + cursor.close(); + adapter.close(); + return items; + } } -- cgit v1.2.3