[Android] Fix auto-reselecting scanned folders in onboarding
Nicolas Pomepuy
git at videolan.org
Tue Mar 19 15:35:23 CET 2019
vlc-android | branch: 3.1.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Mar 19 07:15:05 2019 +0100| [1e8ae7a23a9a350eb501dd5ef7d169096b7bbf81] | committer: Geoffrey Métais
Fix auto-reselecting scanned folders in onboarding
> https://code.videolan.org/videolan/vlc-android/commit/1e8ae7a23a9a350eb501dd5ef7d169096b7bbf81
---
.../org/videolan/vlc/gui/browser/StorageBrowserFragment.kt | 13 ++++++++-----
1 file changed, 8 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 a1346cd27..8d6ce922c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -54,7 +54,6 @@ import org.videolan.vlc.gui.dialogs.showContext
import org.videolan.vlc.gui.helpers.MedialibraryUtils
import org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
import org.videolan.vlc.gui.helpers.UiTools
-import org.videolan.vlc.util.sanitizePath
import org.videolan.vlc.gui.onboarding.OnboardingActivity
import org.videolan.vlc.util.*
import org.videolan.vlc.viewmodels.browser.BrowserModel
@@ -176,9 +175,13 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
val checked = tscb.state == ThreeStatesCheckbox.STATE_CHECKED
val activity = requireActivity()
if (activity is OnboardingActivity) {
-
- if (checked) MediaParsingService.preselectedStorages.add(mrl.sanitizePath())
- else MediaParsingService.preselectedStorages.remove(mrl.sanitizePath())
+ val path = mrl.sanitizePath()
+ if (checked) {
+ MediaParsingService.preselectedStorages.removeAll { it.startsWith(path) }
+ MediaParsingService.preselectedStorages.add(path)
+ } else {
+ MediaParsingService.preselectedStorages.removeAll { it.startsWith(path) }
+ }
} else {
if (checked) {
MedialibraryUtils.addDir(mrl, v.context.applicationContext)
@@ -248,7 +251,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
return at OnClickListener
}
- coroutineScope.launch(CoroutineExceptionHandler{ _, _ ->}) {
+ coroutineScope.launch(CoroutineExceptionHandler { _, _ -> }) {
viewModel.addCustomDirectory(f.canonicalPath).join()
viewModel.browserRoot()
}
More information about the Android
mailing list