[Android] PlaylistManager: Save current index before expand
Geoffrey Métais
git at videolan.org
Thu Feb 22 14:03:10 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 22 14:00:59 2018 +0100| [fcb45f4927dac54b77baac589580fb45a2d452d9] | committer: Geoffrey Métais
PlaylistManager: Save current index before expand
> https://code.videolan.org/videolan/vlc-android/commit/fcb45f4927dac54b77baac589580fb45a2d452d9
---
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 ++++---
1 file changed, 4 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 9afd481e8..1738b962d 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -503,20 +503,21 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
*/
@MainThread
private suspend fun expand(updateHistory: Boolean): Int {
+ val index = currentIndex
val ml = player.expand()
var ret = -1
if (ml != null && ml.count > 0) {
val mrl = if (updateHistory) getCurrentMedia()?.location else null
- mediaList.remove(currentIndex)
+ mediaList.remove(index)
for (i in ml.count - 1 downTo 0) {
val child = ml.getMediaAt(i)
child.parse()
- mediaList.insert(currentIndex, MediaWrapper(child))
+ mediaList.insert(index, MediaWrapper(child))
child.release()
}
if (mrl !== null && ml.count == 1) medialibrary.addToHistory(mrl, getCurrentMedia()!!.title)
- ret = currentIndex
+ ret = index
}
ml?.release()
return ret
More information about the Android
mailing list