[Android] Playlist: Update only once on append

Geoffrey Métais git at videolan.org
Fri Feb 15 10:23:10 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 15 10:14:11 2019 +0100| [a56ef8ce4dc160da9c3cb614a145411ca30d9edb] | committer: Geoffrey Métais

Playlist: Update only once on append

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

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 22e2928f0..3161a1321 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -175,9 +175,9 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         return true
     }
 
-    private suspend fun onPlaylistLoaded() {
+    private fun onPlaylistLoaded() {
         service.onPlaylistLoaded()
-        determinePrevAndNextIndices()
+        addUpdateActor.offer(Unit)
     }
 
     fun play() {
@@ -661,7 +661,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
             return
         }
         val list = withContext(Dispatchers.IO) { list.getWithMLMeta() }
+        mediaList.removeEventListener(this)
         for (media in list) mediaList.add(media)
+        mediaList.addEventListener(this)
+        addUpdateActor.offer(Unit)
     }
 
     /**



More information about the Android mailing list