[Android] Fix state for loadlastplaylist

Geoffrey Métais git at videolan.org
Thu May 3 14:20:04 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May  3 14:19:13 2018 +0200| [2ae2fc93514f22dfc90f7d2d0e957ede19e4d657] | committer: Geoffrey Métais

Fix state for loadlastplaylist

> https://code.videolan.org/videolan/vlc-android/commit/2ae2fc93514f22dfc90f7d2d0e957ede19e4d657
---

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 72f0379db..170e3da38 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -8,8 +8,11 @@ import android.support.v7.preference.PreferenceManager
 import android.text.TextUtils
 import android.util.Log
 import android.widget.Toast
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.experimental.CommonPool
+import kotlinx.coroutines.experimental.CoroutineStart
 import kotlinx.coroutines.experimental.android.UI
+import kotlinx.coroutines.experimental.launch
+import kotlinx.coroutines.experimental.withContext
 import org.videolan.libvlc.Media
 import org.videolan.libvlc.MediaPlayer
 import org.videolan.medialibrary.Medialibrary
@@ -116,9 +119,15 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         loadingLastPlaylist = true
         val audio = type == Constants.PLAYLIST_TYPE_AUDIO
         val currentMedia = settings.getString(if (audio) "current_song" else "current_media", "")
-        if ("" == currentMedia) return false
+        if ("" == currentMedia) {
+            loadingLastPlaylist = false
+            return false
+        }
         val locations = settings.getString(if (audio) "audio_list" else "media_list", "").split(" ".toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()
-        if (Util.isArrayEmpty(locations)) return false
+        if (Util.isArrayEmpty(locations)) {
+            loadingLastPlaylist = false
+            return false
+        }
         launch(UI, CoroutineStart.UNDISPATCHED) {
             val playList = withContext(CommonPool) {
                 locations.map { Uri.decode(it) }.mapTo(ArrayList(locations.size)) { MediaWrapper(Uri.parse(it)) }



More information about the Android mailing list