diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2019-10-24 22:27:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 22:27:48 +0200 |
commit | 385bd3597b7012817faeaa6736ba63f4ba0797e0 (patch) | |
tree | 0c263318fdf982077d8ce5b787ba5afd76f1acde /app/src/main | |
parent | f41bdcbaf21cc6f8172ee14ea211634292e985f3 (diff) | |
parent | a8c1b3c87cb9e60bf6328de972dda3b0420e310c (diff) | |
download | AntennaPod-385bd3597b7012817faeaa6736ba63f4ba0797e0.zip |
Merge pull request #3550 from ByteHamster/remove-resume-intent
Removed resume intent
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/PlayActionButton.java | 17 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/StreamActionButton.java | 18 |
2 files changed, 18 insertions, 17 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 23a7e03ad..0d314b5eb 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 @@ -12,7 +12,6 @@ import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE; -import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE; class PlayActionButton extends ItemActionButton { @@ -52,12 +51,14 @@ class PlayActionButton extends ItemActionButton { } private void togglePlayPause(Context context, FeedMedia media) { - new PlaybackServiceStarter(context, media) - .startWhenPrepared(true) - .shouldStream(false) - .start(); - - String pauseOrResume = media.isCurrentlyPlaying() ? ACTION_PAUSE_PLAY_CURRENT_EPISODE : ACTION_RESUME_PLAY_CURRENT_EPISODE; - IntentUtils.sendLocalBroadcast(context, pauseOrResume); + if (media.isCurrentlyPlaying()) { + IntentUtils.sendLocalBroadcast(context, ACTION_PAUSE_PLAY_CURRENT_EPISODE); + } else { + new PlaybackServiceStarter(context, media) + .callEvenIfRunning(true) + .startWhenPrepared(true) + .shouldStream(false) + .start(); + } } } diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/StreamActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/StreamActionButton.java index dc7fd1e7a..c1e619fdf 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/StreamActionButton.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/StreamActionButton.java @@ -13,7 +13,6 @@ import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE; -import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE; public class StreamActionButton extends ItemActionButton { @@ -52,13 +51,14 @@ public class StreamActionButton extends ItemActionButton { } private void togglePlayPause(Context context, FeedMedia media) { - new PlaybackServiceStarter(context, media) - .startWhenPrepared(true) - .shouldStream(true) - .start(); - - String pauseOrResume = media.isCurrentlyPlaying() - ? ACTION_PAUSE_PLAY_CURRENT_EPISODE : ACTION_RESUME_PLAY_CURRENT_EPISODE; - IntentUtils.sendLocalBroadcast(context, pauseOrResume); + if (media.isCurrentlyPlaying()) { + IntentUtils.sendLocalBroadcast(context, ACTION_PAUSE_PLAY_CURRENT_EPISODE); + } else { + new PlaybackServiceStarter(context, media) + .callEvenIfRunning(true) + .startWhenPrepared(true) + .shouldStream(true) + .start(); + } } } |