From c00b5f4033f6c4e74d5a30efd253482250510477 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Sun, 20 Sep 2015 17:03:52 -0400 Subject: we can't delegate here --- .../java/de/danoeh/antennapod/core/storage/DBWriter.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index f89099efb..bae31b52b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -461,7 +461,18 @@ public class DBWriter { } public static Future addFavoriteItemById(final long itemId) { - return addFavoriteItem(DBReader.getFeedItem(itemId)); + return dbExec.submit(() -> { + final FeedItem item = DBReader.getFeedItem(itemId); + if (item == null) { + Log.d(TAG, "Can't find item for itemId " + itemId); + return; + } + final PodDBAdapter adapter = PodDBAdapter.getInstance().open(); + adapter.addFavoriteItem(item); + adapter.close(); + item.addTag(FeedItem.TAG_FAVORITE); + EventBus.getDefault().post(FavoritesEvent.added(item)); + }); } public static Future removeFavoriteItem(final FeedItem item) { -- cgit v1.2.3