[Android] Make StorageBrowserFragment a CoroutineScope
Geoffrey Métais
git at videolan.org
Wed Feb 27 11:27:40 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 27 11:27:17 2019 +0100| [c245fedb0f421360b1463b414a51119e63ca9754] | committer: Geoffrey Métais
Make StorageBrowserFragment a CoroutineScope
> https://code.videolan.org/videolan/vlc-android/commit/c245fedb0f421360b1463b414a51119e63ca9754
---
.../src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
index 898982730..1121499ab 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -38,9 +38,7 @@ import androidx.collection.SimpleArrayMap
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProviders
-import kotlinx.coroutines.CoroutineExceptionHandler
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.launch
+import kotlinx.coroutines.*
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.medialibrary.interfaces.EntryPointsEventsCb
import org.videolan.medialibrary.media.MediaLibraryItem
@@ -65,7 +63,7 @@ import java.io.File
const val KEY_IN_MEDIALIB = "key_in_medialib"
@ExperimentalCoroutinesApi
-class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
+class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, CoroutineScope by MainScope() {
internal var mScannedDirectory = false
private val mProcessingFolders = SimpleArrayMap<String, CheckBox>()
@@ -107,7 +105,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
}
override fun onRestart() {
- (adapter as StorageBrowserAdapter).updateListState(requireContext())
+ launch { (adapter as StorageBrowserAdapter).updateListState(requireContext()) }
}
override fun onStop() {
More information about the Android
mailing list