[Android] Fix saved play queue encoding

Geoffrey Métais git at videolan.org
Wed Feb 26 15:06:16 CET 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 26 10:59:37 2020 +0100| [9ae842ba8d4bdf6a8b5ede475690897935f876f5] | committer: Geoffrey Métais

Fix saved play queue encoding

> https://code.videolan.org/videolan/vlc-android/commit/9ae842ba8d4bdf6a8b5ede475690897935f876f5
---

 .../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 1887924fc..5d9ac003b 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -161,14 +161,15 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
             loadingLastPlaylist = false
             return false
         }
-        val locations = settings.getString(if (audio) "audio_list" else "media_list", null)?.split(" ".toRegex())?.dropLastWhile({ it.isEmpty() })?.toTypedArray()
+        val locations = settings.getString(if (audio) "audio_list" else "media_list", null)
+                ?.split(" ".toRegex())?.dropLastWhile { it.isEmpty() }?.toTypedArray()
         if (locations?.isNotEmpty() != true) {
             loadingLastPlaylist = false
             return false
         }
         launch {
             val playList = withContext(Dispatchers.Default) {
-                locations.asSequence().map { Uri.decode(it) }.mapTo(ArrayList(locations.size)) {
+                locations.asSequence().mapTo(ArrayList(locations.size)) {
                     MLServiceLocator.getAbstractMediaWrapper(Uri.parse(it))
                 }
             }
@@ -491,7 +492,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         val locations = StringBuilder()
         withContext(Dispatchers.Default) {
             val list = mediaList.copy.takeIf { it.isNotEmpty() } ?: return at withContext
-            for (mw in list) locations.append(" ").append(Uri.encode(Uri.decode(mw.uri.toString())))
+            for (mw in list) locations.append(" ").append(mw.uri.toString())
             //We save a concatenated String because putStringSet is APIv11.
             settings.edit()
                     .putString(if (isAudioList()) "audio_list" else "media_list", locations.toString().trim())



More information about the Android mailing list