summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-04-01 09:55:30 +0200
committerGitHub <noreply@github.com>2024-04-01 09:55:30 +0200
commita846e417b030e1491c472d50651d58a8f2c15c0e (patch)
treed2bb8df773e595977cd24008bde91cd998c1890a
parentedb440a5a9a05e24c344a71b272b9238217e9c55 (diff)
downloadAntennaPod-a846e417b030e1491c472d50651d58a8f2c15c0e.zip
Fix playback state not being updated (#7050)
-rw-r--r--playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java2
-rw-r--r--storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/PlaybackPreferences.java4
2 files changed, 6 insertions, 0 deletions
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
index 138c9bc61..dfcb67e51 100644
--- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
+++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
@@ -831,6 +831,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
break;
case PAUSED:
updateNotificationAndMediaSession(newInfo.playable);
+ PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED);
if (!isCasting) {
stateManager.stopForeground(!UserPreferences.isPersistNotify());
}
@@ -841,6 +842,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
//stopService();
break;
case PLAYING:
+ PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING);
saveCurrentPosition(true, null, Playable.INVALID_TIME);
recreateMediaSessionIfNeeded();
updateNotificationAndMediaSession(newInfo.playable);
diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/PlaybackPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/PlaybackPreferences.java
index d6d260446..9ec20bd2c 100644
--- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/PlaybackPreferences.java
+++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/PlaybackPreferences.java
@@ -109,6 +109,10 @@ public abstract class PlaybackPreferences {
return prefs.getInt(PREF_CURRENT_PLAYER_STATUS, PLAYER_STATUS_OTHER);
}
+ public static void setCurrentPlayerStatus(int playerStatus) {
+ prefs.edit().putInt(PREF_CURRENT_PLAYER_STATUS, playerStatus).apply();
+ }
+
public static float getCurrentlyPlayingTemporaryPlaybackSpeed() {
return prefs.getFloat(PREF_CURRENTLY_PLAYING_TEMPORARY_PLAYBACK_SPEED, FeedPreferences.SPEED_USE_GLOBAL);
}