[Android] Set browerprovider actor before init

Geoffrey Métais git at videolan.org
Fri Sep 14 17:25:09 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep 14 17:12:30 2018 +0200| [66a7278f61e912c0e1023cf2799bb187608523d7] | committer: Geoffrey Métais

Set browerprovider actor before init

> https://code.videolan.org/videolan/vlc-android/commit/66a7278f61e912c0e1023cf2799bb187608523d7
---

 .../src/org/videolan/vlc/providers/BrowserProvider.kt      | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 99ffa971f..a5b1fb932 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -60,6 +60,14 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
     val descriptionUpdate = MutableLiveData<Pair<Int, String>>()
     internal val medialibrary = Medialibrary.getInstance()
 
+    private val browserActor = actor<BrowserAction>(Dispatchers.IO, Channel.UNLIMITED) {
+        for (action in channel) when (action) {
+            is Browse -> browseImpl(action.url)
+            is Refresh -> refreshImpl()
+            is ParseSubDirectories -> parseSubDirectoriesImpl()
+        }
+    }
+
     init {
         fetch()
     }
@@ -225,12 +233,6 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
 
     fun isFolderEmpty(mw: MediaWrapper) = foldersContentMap[mw]?.isEmpty() ?: true
 
-    private val browserActor = actor<BrowserAction>(Dispatchers.IO, Channel.UNLIMITED) { for (action in channel) when (action) {
-        is Browse -> browseImpl(action.url)
-        is Refresh -> refreshImpl()
-        is ParseSubDirectories -> parseSubDirectoriesImpl()
-    } }
-
     companion object {
         private val browserHandler by lazy {
             val handlerThread = HandlerThread("vlc-mProvider", Process.THREAD_PRIORITY_DEFAULT + Process.THREAD_PRIORITY_LESS_FAVORABLE)



More information about the Android mailing list