[Android] Playlist: Update only once on expand

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


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

Playlist: Update only once on expand

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

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 3161a1321..26c2cc84f 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -585,6 +585,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
 
         if (ml != null && ml.count > 0) {
             val mrl = if (updateHistory) getCurrentMedia()?.location else null
+            mediaList.removeEventListener(this)
             mediaList.remove(index)
             for (i in 0 until ml.count) {
                 val child = ml.getMediaAt(i)
@@ -592,6 +593,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                 mediaList.insert(index+i, MediaWrapper(child))
                 child.release()
             }
+            mediaList.addEventListener(this)
+            addUpdateActor.offer(Unit)
             if (mrl !== null && ml.count == 1) {
                 getCurrentMedia()?.apply {
                     launch(Dispatchers.IO) {



More information about the Android mailing list