From 88289d02ae2a402ec77723dd53da33e9cf4c7311 Mon Sep 17 00:00:00 2001
From: Vishnu Sanal T <50027064+VishnuSanal@users.noreply.github.com>
Date: Sun, 1 Jan 2023 19:59:23 +0530
Subject: Possibility to remove a single episode from playback history (#6184)
---
.../de/danoeh/antennapod/core/storage/DBWriter.java | 21 ++++++++++++++++++---
core/src/main/res/drawable/ic_history_remove.xml | 12 ++++++++++++
2 files changed, 30 insertions(+), 3 deletions(-)
create mode 100644 core/src/main/res/drawable/ic_history_remove.xml
(limited to 'core')
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 media
*/
- 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 @@
+
+
+
+
--
cgit v1.2.3