File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed
filepicker/src/main/java/dev/arkbuilders/components/filepicker
utils/src/main/java/dev/arkbuilders/components/utils Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import androidx.core.os.bundleOf
44import androidx.fragment.app.setFragmentResult
55import androidx.lifecycle.lifecycleScope
66import dev.arkbuilders.arklib.data.folders.FoldersRepo
7+ import dev.arkbuilders.arklib.utils.INTERNAL_STORAGE
78import dev.arkbuilders.components.utils.hasNestedRoot
8- import dev.arkbuilders.components.utils.isInternalStorage
99import kotlinx.coroutines.Dispatchers
1010import kotlinx.coroutines.launch
1111import java.nio.file.Path
@@ -18,7 +18,7 @@ class ArkRootPickerFragment : ArkFilePickerFragment() {
1818 val folders = FoldersRepo .instance.provideFolders()
1919 val roots = folders.keys
2020
21- if (currentFolder.isInternalStorage() || currentFolder.hasNestedRoot(roots)) {
21+ if (currentFolder == INTERNAL_STORAGE || currentFolder.hasNestedRoot(roots)) {
2222 rootNotFavorite = true
2323 binding.btnPick.text = getString(R .string.ark_file_picker_root)
2424 binding.btnPick.isEnabled = false
Original file line number Diff line number Diff line change 11package dev.arkbuilders.components.utils
22
33import java.nio.file.Path
4- import kotlin.io.path.Path
5-
6- val INTERNAL_STORAGE = Path (" /storage/emulated/0" )
74
85fun Path.hasNestedOrParentalRoot (roots : Iterable <Path >): Boolean {
96 val hasNestedRoot = roots.any { path ->
@@ -12,6 +9,4 @@ fun Path.hasNestedOrParentalRoot(roots: Iterable<Path>): Boolean {
129 return hasNestedRoot
1310}
1411
15- fun Path.hasNestedRoot (roots : Iterable <Path >) = roots.any { it.startsWith(this ) }
16-
17- fun Path.isInternalStorage () = this == INTERNAL_STORAGE
12+ fun Path.hasNestedRoot (roots : Iterable <Path >) = roots.any { it.startsWith(this ) }
You can’t perform that action at this time.
0 commit comments