[Android] End loading when a network share has been found

Geoffrey Métais git at videolan.org
Fri Jul 5 14:07:43 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jul  5 12:04:42 2019 +0200| [20838b2530c1f106e651f5b048aea206f66ec3ba] | committer: Geoffrey Métais

End loading when a network share has been found

> https://code.videolan.org/videolan/vlc-android/commit/20838b2530c1f106e651f5b048aea206f66ec3ba
---

 vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 81ec5db1c..2addca2cf 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -35,8 +35,8 @@ import kotlinx.coroutines.channels.mapNotNullTo
 import org.videolan.libvlc.Media
 import org.videolan.libvlc.util.MediaBrowser
 import org.videolan.libvlc.util.MediaBrowser.EventListener
-import org.videolan.medialibrary.interfaces.AbstractMedialibrary
 import org.videolan.medialibrary.MLServiceLocator
+import org.videolan.medialibrary.interfaces.AbstractMedialibrary
 import org.videolan.medialibrary.interfaces.media.AbstractMediaWrapper
 import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.medialibrary.media.Storage
@@ -105,7 +105,10 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
     private suspend fun browseImpl(url: String? = null) {
         browserChannel = Channel(Channel.UNLIMITED)
         requestBrowsing(url)
-        for (media in browserChannel) findMedia(media)?.let { addMedia(it) }
+        for (media in browserChannel) findMedia(media)?.let {
+            if (url === null) loading.postValue(false)
+            addMedia(it)
+        }
         if (dataset.value.isNotEmpty()) parseSubDirectories()
         else dataset.clear() // send observable event when folder is empty
         loading.postValue(false)



More information about the Android mailing list