[Android] PlaylistManager: Save current index before expand
Geoffrey Métais
git at videolan.org
Thu Feb 22 15:29:58 CET 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 22 14:00:59 2018 +0100| [c3b48fc9f48c9db94f5f804e7eeeb62fcf0de0c7] | committer: Geoffrey Métais
PlaylistManager: Save current index before expand
(cherry picked from commit fcb45f4927dac54b77baac589580fb45a2d452d9)
> https://code.videolan.org/videolan/vlc-android/commit/c3b48fc9f48c9db94f5f804e7eeeb62fcf0de0c7
---
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