[Android] Restore systematic media expand

Geoffrey Métais git at videolan.org
Tue May 15 15:53:29 CEST 2018


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

Restore systematic media expand

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

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 5 ++++-
 vlc-android/src/org/videolan/vlc/util/Kextensions.kt      | 6 +++++-
 2 files changed, 9 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 181914e84..e7e02b9ae 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -683,7 +683,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(
diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index ede160541..7a1db9016 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -7,6 +7,7 @@ import android.support.v4.app.Fragment
 import android.support.v4.app.FragmentActivity
 import kotlinx.coroutines.experimental.CoroutineStart
 import kotlinx.coroutines.experimental.delay
+import org.videolan.libvlc.Media
 import java.io.File
 import java.net.URI
 import java.net.URISyntaxException
@@ -47,4 +48,7 @@ suspend fun retry (
     return block() // last attempt
 }
 
-fun uiStart() = if (Looper.getMainLooper() == Looper.myLooper()) CoroutineStart.UNDISPATCHED else CoroutineStart.DEFAULT
\ No newline at end of file
+fun uiStart() = if (Looper.getMainLooper() == Looper.myLooper()) CoroutineStart.UNDISPATCHED else CoroutineStart.DEFAULT
+
+fun Media?.canExpand() = this != null && (type == Media.Type.Directory || type == Media.Type.Playlist)
+



More information about the Android mailing list