[Android] Browser: post loading values in main thread
Geoffrey Métais
git at videolan.org
Tue Jun 25 10:22:09 CEST 2019
vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 25 09:57:51 2019 +0200| [3a498afcdee1a059d8df08607d4928e3b8f9590f] | committer: Geoffrey Métais
Browser: post loading values in main thread
> https://code.videolan.org/videolan/vlc-android/commit/3a498afcdee1a059d8df08607d4928e3b8f9590f
---
vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index a1f26cbff..773014947 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -93,7 +93,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
}
protected open fun browse(url: String? = null) {
- loading.value = true
+ loading.postValue(true)
if (!browserActor.isClosedForSend) browserActor.offer(Browse(url))
}
@@ -104,7 +104,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
for (media in browserChannel) findMedia(media)?.let { addMedia(it) }
if (dataset.value.isNotEmpty()) parseSubDirectories()
else dataset.clear() // send observable event when folder is empty
- loading.value = false
+ loading.postValue(false)
}
}
@@ -112,7 +112,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
open fun refresh() : Boolean {
if (url === null || browserActor.isClosedForSend) return false
- loading.value = true
+ loading.postValue(true)
browserActor.offer(Refresh)
return true
}
@@ -127,7 +127,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
job = launch {
dataset.value = browserChannel.mapNotNullTo(mutableListOf()) { findMedia(it) }
parseSubDirectories()
- loading.value = false
+ loading.postValue(false)
}
}
@@ -251,7 +251,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
}
}
}
- loading.value = false
+ loading.postValue(false)
}
protected fun getList(url: String) = prefetchLists[url]
More information about the Android
mailing list