diff options
author | Vishnu Sanal T <50027064+VishnuSanal@users.noreply.github.com> | 2023-01-01 19:59:23 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-01 15:29:23 +0100 |
commit | 88289d02ae2a402ec77723dd53da33e9cf4c7311 (patch) | |
tree | 998806d05abcb74bed8d56e74742aa3473783a0c /core | |
parent | 97889a46ed2f9e6e5fc6144b84f1c2367d311a05 (diff) | |
download | AntennaPod-88289d02ae2a402ec77723dd53da33e9cf4c7311.zip |
Possibility to remove a single episode from playback history (#6184)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java | 21 | ||||
-rw-r--r-- | core/src/main/res/drawable/ic_history_remove.xml | 12 |
2 files changed, 30 insertions, 3 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 c7a1d1515..9b4146f15 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 @@ -257,6 +257,20 @@ public class DBWriter { }); } + public static Future<?> deleteFromPlaybackHistory(FeedItem feedItem) { + return addItemToPlaybackHistory(feedItem.getMedia(), new Date(0)); + } + + /** + * Adds a FeedMedia object to the playback history. A FeedMedia object is in the playback history if + * its playback completion date is set to a non-null value. This method will set the playback completion date to the + * current date regardless of the current value. + * + * @param media FeedMedia that should be added to the playback history. + */ + public static Future<?> addItemToPlaybackHistory(FeedMedia media) { + return addItemToPlaybackHistory(media, new Date()); + } /** * Adds a FeedMedia object to the playback history. A FeedMedia object is in the playback history if @@ -264,11 +278,12 @@ public class DBWriter { * current date regardless of the current value. * * @param media FeedMedia that should be added to the playback history. + * @param date PlaybackCompletionDate for <code>media</code> */ - public static Future<?> addItemToPlaybackHistory(final FeedMedia media) { + public static Future<?> addItemToPlaybackHistory(final FeedMedia media, Date date) { return dbExec.submit(() -> { - Log.d(TAG, "Adding new item to playback history"); - media.setPlaybackCompletionDate(new Date()); + Log.d(TAG, "Adding item to playback history"); + media.setPlaybackCompletionDate(date); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); diff --git a/core/src/main/res/drawable/ic_history_remove.xml b/core/src/main/res/drawable/ic_history_remove.xml new file mode 100644 index 000000000..12d475a60 --- /dev/null +++ b/core/src/main/res/drawable/ic_history_remove.xml @@ -0,0 +1,12 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M13,3C8.03,3 4,7.03 4,12H1L4.89,15.89L4.96,16.03L9,12H6C6,8.13 9.13,5 13,5C16.87,5 20,8.13 20,12C20,15.87 16.87,19 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,19.99 10.51,21 13,21C17.97,21 22,16.97 22,12C22,7.03 17.97,3 13,3Z" + android:fillColor="?attr/action_icon_color"/> + <path + android:pathData="M10.93 15.2 13 13.13 15.07 15.2 16.2 14.07 14.13 12 16.2 9.93 15.07 8.8 13 10.87 10.93 8.8 9.8 9.93 11.87 12 9.8 14.07 10.93 15.2Z" + android:fillColor="?attr/action_icon_color"/> +</vector> |