|
@@ -27,7 +27,7 @@ import eu.kanade.tachiyomi.util.preference.preference
|
|
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
|
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
|
import eu.kanade.tachiyomi.util.preference.switchPreference
|
|
import eu.kanade.tachiyomi.util.preference.switchPreference
|
|
import eu.kanade.tachiyomi.util.preference.titleRes
|
|
import eu.kanade.tachiyomi.util.preference.titleRes
|
|
-import eu.kanade.tachiyomi.util.system.getFilePicker
|
|
|
|
|
|
+import eu.kanade.tachiyomi.util.system.toast
|
|
import kotlinx.coroutines.flow.launchIn
|
|
import kotlinx.coroutines.flow.launchIn
|
|
import kotlinx.coroutines.flow.onEach
|
|
import kotlinx.coroutines.flow.onEach
|
|
import uy.kohesive.injekt.Injekt
|
|
import uy.kohesive.injekt.Injekt
|
|
@@ -155,12 +155,12 @@ class SettingsDownloadController : SettingsController() {
|
|
preferences.downloadsDirectory().set(path.toString())
|
|
preferences.downloadsDirectory().set(path.toString())
|
|
}
|
|
}
|
|
|
|
|
|
- fun customDirectorySelected(currentDir: String) {
|
|
|
|
|
|
+ fun customDirectorySelected() {
|
|
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
|
|
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
|
|
try {
|
|
try {
|
|
startActivityForResult(intent, DOWNLOAD_DIR)
|
|
startActivityForResult(intent, DOWNLOAD_DIR)
|
|
} catch (e: ActivityNotFoundException) {
|
|
} catch (e: ActivityNotFoundException) {
|
|
- startActivityForResult(preferences.context.getFilePicker(currentDir), DOWNLOAD_DIR)
|
|
|
|
|
|
+ activity?.toast(R.string.file_picker_error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,7 +181,7 @@ class SettingsDownloadController : SettingsController() {
|
|
) { _, position, text ->
|
|
) { _, position, text ->
|
|
val target = targetController as? SettingsDownloadController
|
|
val target = targetController as? SettingsDownloadController
|
|
if (position == externalDirs.lastIndex) {
|
|
if (position == externalDirs.lastIndex) {
|
|
- target?.customDirectorySelected(currentDir)
|
|
|
|
|
|
+ target?.customDirectorySelected()
|
|
} else {
|
|
} else {
|
|
target?.predefinedDirectorySelected(text.toString())
|
|
target?.predefinedDirectorySelected(text.toString())
|
|
}
|
|
}
|