diff options
author | Tom Hennen <tom.hennen@gmail.com> | 2015-09-20 17:03:52 -0400 |
---|---|---|
committer | Tom Hennen <tom.hennen@gmail.com> | 2015-09-20 17:03:52 -0400 |
commit | c00b5f4033f6c4e74d5a30efd253482250510477 (patch) | |
tree | bab53d26f586a63354c7bfe001403a21d8b7a9a9 | |
parent | 3638eed2206468d4ea369b15c0e10c5885c52041 (diff) | |
download | AntennaPod-c00b5f4033f6c4e74d5a30efd253482250510477.zip |
we can't delegate here
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java | 13 |
1 files changed, 12 insertions, 1 deletions
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) { |