summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/adapter
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-03-27 21:01:45 +0100
committerGitHub <noreply@github.com>2024-03-27 21:01:45 +0100
commit1dbda2fb8a070fb30b4314feca839525cfc701eb (patch)
tree30b63908a65915e60439353eea493b175fa959ae /app/src/main/java/de/danoeh/antennapod/adapter
parent130da46f5d9c598ca76f4f2127c08bb4ef225b34 (diff)
downloadAntennaPod-1dbda2fb8a070fb30b4314feca839525cfc701eb.zip
Split up DBTasks which has unclear responsibilities (#7032)
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/adapter')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java
index 983ae3df9..e0a15191e 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java
@@ -1,17 +1,22 @@
package de.danoeh.antennapod.adapter.actionbutton;
import android.content.Context;
+import android.util.Log;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.core.storage.DBWriter;
+import de.danoeh.antennapod.event.FeedItemEvent;
+import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.MediaType;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
-import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
+import org.greenrobot.eventbus.EventBus;
public class PlayActionButton extends ItemActionButton {
+ private static final String TAG = "PlayActionButton";
public PlayActionButton(FeedItem item) {
super(item);
@@ -36,7 +41,12 @@ public class PlayActionButton extends ItemActionButton {
return;
}
if (!media.fileExists()) {
- DBTasks.notifyMissingFeedMediaFile(context, media);
+ Log.i(TAG, "Missing episode. Will update the database now.");
+ media.setDownloaded(false);
+ media.setLocalFileUrl(null);
+ DBWriter.setFeedMedia(media);
+ EventBus.getDefault().post(FeedItemEvent.updated(media.getItem()));
+ EventBus.getDefault().post(new MessageEvent(context.getString(R.string.error_file_not_found)));
return;
}
new PlaybackServiceStarter(context, media)