diff options
author | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-12-02 23:17:56 +0100 |
---|---|---|
committer | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-12-02 23:17:56 +0100 |
commit | b53a3c2ecf32a2bbfaa33b886e31c04f3e0cb8ba (patch) | |
tree | 33b51b00d682c2305f1f2da294815b3b0ad1d551 /core/src/main/java/de | |
parent | 90e62593316e5211a39918dc6ef82333fc7edd64 (diff) | |
download | AntennaPod-b53a3c2ecf32a2bbfaa33b886e31c04f3e0cb8ba.zip |
Move "Delete Removes from Queue" logic to DBWriter
Diffstat (limited to 'core/src/main/java/de')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java | 22 |
1 files changed, 15 insertions, 7 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 bbe6145ea..23ed04866 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 @@ -74,13 +74,7 @@ public class DBWriter { private DBWriter() { } - /** - * Deletes a downloaded FeedMedia file from the storage device. - * - * @param context A context that is used for opening a database connection. - * @param mediaId ID of the FeedMedia object whose downloaded file should be deleted. - */ - public static Future<?> deleteFeedMediaOfItem(final Context context, + private static Future<?> doDeleteFeedMediaOfItem(final Context context, final long mediaId) { return dbExec.submit(() -> { final FeedMedia media = DBReader.getFeedMedia(mediaId); @@ -137,6 +131,20 @@ public class DBWriter { } /** + * Deletes a downloaded FeedMedia file from the storage device. + * + * @param context A context that is used for opening a database connection. + * @param mediaId ID of the FeedMedia object whose downloaded file should be deleted. + */ + public static Future<?> deleteFeedMediaOfItem(final Context context, + final long mediaId) { + if (UserPreferences.shouldDeleteRemoveFromQueue()) { + DBWriter.removeQueueItem(context, DBReader.getFeedMedia(mediaId).getItem(), false); + } + return doDeleteFeedMediaOfItem(context, mediaId); + } + + /** * Deletes a Feed and all downloaded files of its components like images and downloaded episodes. * * @param context A context that is used for opening a database connection. |