[Android] Restore systematic media expand

Geoffrey Métais git at videolan.org
Mon May 14 15:53:16 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 14 09:50:04 2018 +0200| [7867264b2b220b0fea2571577c88dba773fb0d4d] | committer: Geoffrey Métais

Restore systematic media expand

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

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 +++++--
 vlc-android/src/org/videolan/vlc/util/Kextensions.kt      | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 88488b7d8..d87f0af44 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -674,7 +674,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                     if (isBenchmark) player.setPreviousStats()
                     if (nextIndex == -1) savePosition(true)
                 }
-                next()
+                launch(UI, CoroutineStart.UNDISPATCHED) {
+                    determinePrevAndNextIndices(true)
+                    next()
+                }
             }
             MediaPlayer.Event.EncounteredError -> {
                 service.showToast(service.getString(
@@ -686,5 +689,5 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         service.onMediaPlayerEvent(event)
     }
 
-    fun isAudioList() = !player.canSwitchToVideo() && mediaList.isAudioList
+    private fun isAudioList() = !player.canSwitchToVideo() && mediaList.isAudioList
 }
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index ba47d0a7e..d603f0c88 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -1,12 +1,12 @@
 package org.videolan.vlc.util
 
 import kotlinx.coroutines.experimental.delay
+import org.videolan.libvlc.Media
 import java.io.File
 import java.net.URI
 import java.net.URISyntaxException
 import java.util.*
 
-
 fun String.validateLocation(): Boolean {
     var location = this
     /* Check if the MRL contains a scheme */
@@ -36,4 +36,6 @@ suspend fun retry (
         delay(delayTime)
     }
     return block() // last attempt
-}
\ No newline at end of file
+}
+
+fun Media?.canExpand() = this != null && (type == Media.Type.Directory || type == Media.Type.Playlist)



More information about the Android mailing list