[Android] Insert expanded media in correct order

Geoffrey Métais git at videolan.org
Tue Feb 12 15:15:14 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 12 12:16:50 2019 +0100| [fb7640f7032bc78341cc959d2142aac4870f8e4d] | committer: Geoffrey Métais

Insert expanded media in correct order

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

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 4 ++--
 1 file changed, 2 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 e798825d4..c71927e7d 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -580,10 +580,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         if (ml != null && ml.count > 0) {
             val mrl = if (updateHistory) getCurrentMedia()?.location else null
             mediaList.remove(index)
-            for (i in ml.count - 1 downTo 0) {
+            for (i in 0 until ml.count) {
                 val child = ml.getMediaAt(i)
                 withContext(Dispatchers.IO) { child.parse() }
-                mediaList.insert(index, MediaWrapper(child))
+                mediaList.insert(index+i, MediaWrapper(child))
                 child.release()
             }
             if (mrl !== null && ml.count == 1) {



More information about the Android mailing list