[Android] Fix refresh & empty folders browsing
Geoffrey Métais
git at videolan.org
Wed Aug 8 16:35:18 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Aug 8 16:34:43 2018 +0200| [6af5a16a6899cf72f681f2f4e268b5c8da0400ab] | committer: Geoffrey Métais
Fix refresh & empty folders browsing
> https://code.videolan.org/videolan/vlc-android/commit/6af5a16a6899cf72f681f2f4e268b5c8da0400ab
---
.../src/org/videolan/vlc/providers/BrowserProvider.kt | 14 ++------------
.../src/org/videolan/vlc/providers/FileBrowserProvider.kt | 2 --
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 62f8dd45b..c0ee354e7 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -88,10 +88,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
browserChannel = Channel(Channel.UNLIMITED)
requestBrowsing(url)
job = launch(UI.immediate) {
- for (media in browserChannel) {
- if (isActive) addMedia(findMedia(media))
- else return at launch
- }
+ dataset.value = browserChannel.mapTo(mutableListOf()) { findMedia(it) }
parseSubDirectories()
}
}
@@ -100,14 +97,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
open fun refresh(): Boolean {
if (url === null) return false
- browserChannel = Channel(Channel.UNLIMITED)
- val refreshList = mutableListOf<MediaLibraryItem>()
- requestBrowsing(url)
- job = launch(UI.immediate) {
- browserChannel.mapTo(refreshList) { findMedia(it) }
- dataset.value = refreshList
- parseSubDirectories()
- }
+ browse()
return true
}
diff --git a/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
index cd29e303a..476b3371a 100644
--- a/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
@@ -133,8 +133,6 @@ open class FileBrowserProvider(
}
}
- override fun refresh() = true
-
override fun release(): Job {
if (url == null) {
ExternalMonitor.devices.removeObserver(this)
More information about the Android
mailing list