Commit 46436f0d authored by Geoffrey Métais's avatar Geoffrey Métais

BrowserProvider: control browser in background

Prevents ANR
parent f9079aca
......@@ -64,8 +64,10 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
private val completionHandler : CompletionHandler = object : CompletionHandler {
override fun invoke(cause: Throwable?) {
mediabrowser?.release()
mediabrowser = null
launch(Dispatchers.IO) {
mediabrowser?.release()
mediabrowser = null
}
if (this@BrowserProvider::browserChannel.isInitialized) browserChannel.close()
}
......@@ -77,7 +79,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
BrowseRoot -> browseRootImpl()
Refresh -> refreshImpl()
ParseSubDirectories -> parseSubDirectoriesImpl()
ClearListener -> mediabrowser?.changeEventListener(null)
ClearListener -> withContext(Dispatchers.IO) { mediabrowser?.changeEventListener(null) }
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment