[Android] Prevent loading last playlist when history is disabled

Nicolas Pomepuy git at videolan.org
Mon Nov 22 12:48:04 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov 22 11:51:56 2021 +0100| [4d50e0c46ae6a449f886eecc718bf7850f8a4506] | committer: Nicolas Pomepuy

Prevent loading last playlist when history is disabled

Fixes #2254

> https://code.videolan.org/videolan/vlc-android/commit/4d50e0c46ae6a449f886eecc718bf7850f8a4506
---

 application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt b/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
index d4404d7f4..c8ed8ef3a 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
@@ -18,6 +18,7 @@ import org.videolan.medialibrary.interfaces.media.MediaWrapper
 import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.resources.*
 import org.videolan.resources.util.getFromMl
+import org.videolan.tools.PLAYBACK_HISTORY
 import org.videolan.tools.Settings
 import org.videolan.tools.removeQuery
 import org.videolan.tools.retrieveParent
@@ -42,14 +43,14 @@ internal class MediaSessionCallback(private val playbackService: PlaybackService
 
     override fun onPlay() {
         if (playbackService.hasMedia()) playbackService.play()
-        else if (!AndroidDevices.isAndroidTv) PlaybackService.loadLastAudio(playbackService)
+        else if (!AndroidDevices.isAndroidTv && Settings.getInstance(playbackService).getBoolean(PLAYBACK_HISTORY, true)) PlaybackService.loadLastAudio(playbackService)
     }
 
     override fun onMediaButtonEvent(mediaButtonEvent: Intent): Boolean {
         val keyEvent = mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT) as KeyEvent? ?: return false
         if (!playbackService.hasMedia()
                 && (keyEvent.keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyEvent.keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE)) {
-            return if (keyEvent.action == KeyEvent.ACTION_DOWN) {
+            return if (keyEvent.action == KeyEvent.ACTION_DOWN && Settings.getInstance(playbackService).getBoolean(PLAYBACK_HISTORY, true)) {
                 PlaybackService.loadLastAudio(playbackService)
                 true
             } else false



More information about the Android mailing list