summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Gusev <andy.gusev@list.ru>2023-11-28 21:50:49 +0300
committerGitHub <noreply@github.com>2023-11-28 19:50:49 +0100
commitb792eaa18e864db4e3998ca63748badb5462ea70 (patch)
tree02527a0e18c9ef2ef0fdcf59327ba80e58606bea
parent6177cc2460992f945e1ce32adb3b7aaac85c95d4 (diff)
downloadAntennaPod-b792eaa18e864db4e3998ca63748badb5462ea70.zip
Make onPlayFromSearch continue playback (#6779)
According to the Android documentation, if onPlayFromSearch is called with an empty query, the app should make a decision what to play. Before, a database search with this empty query was performed, which returned arbitrary results. Now we play the last played episode instead.
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index 9242ea2c1..0423cfa01 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -1765,6 +1765,12 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onPlayFromSearch(String query, Bundle extras) {
Log.d(TAG, "onPlayFromSearch query=" + query + " extras=" + extras.toString());
+ if (query.equals("")) {
+ Log.d(TAG, "onPlayFromSearch called with empty query, resuming from the last position");
+ startPlayingFromPreferences();
+ return;
+ }
+
List<FeedItem> results = FeedSearcher.searchFeedItems(query, 0);
if (results.size() > 0 && results.get(0).getMedia() != null) {
FeedMedia media = results.get(0).getMedia();