[Android] Fix inconsistency between removed and restored playlist items

Nicolas Pomepuy git at videolan.org
Tue Apr 13 06:44:32 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr  6 14:14:38 2021 +0200| [00680a62b3cabab8ef5d3e6f74c104f1623edf79] | committer: Nicolas Pomepuy

Fix inconsistency between removed and restored playlist items

Fixes #1706

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

 .../vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt      | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
index 578106761..b4e38c7ee 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
@@ -439,15 +439,9 @@ open class PlaylistActivity : AudioPlayerContainerActivity(), IEventsHandler<Med
         itemTouchHelperCallback.swipeEnabled = false
         lifecycleScope.launchWhenStarted {
             val tracks = withContext(Dispatchers.IO) { playlist.tracks }
-            for (mediaItem in list) {
-                for (i in tracks.indices) {
-                    if (tracks[i].id == mediaItem.id) {
-                        itemsRemoved[i] = mediaItem.id
-                    }
-                }
-            }
             withContext(Dispatchers.IO) {
                 for ((index, playlistIndex) in indexes.sortedBy { it }.withIndex()) {
+                    itemsRemoved[playlistIndex] = tracks[playlistIndex].id
                     playlist.remove(playlistIndex - index)
                 }
             }



More information about the Android mailing list