From 818bda53aca5c35b00fa11352ad2d10a7b442a93 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 31 Dec 2021 08:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E4=B9=A6=E7=B1=8D=E6=97=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=88=99=E4=BF=9D=E5=AD=98=E5=88=B0=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E9=80=89=E5=AE=9A=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/association/FileAssociationActivity.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt index 6ff5d65a7..0cdb6ba84 100644 --- a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt @@ -25,12 +25,15 @@ class FileAssociationActivity : VMBaseActivity() { private val localBookTreeSelect = registerForActivityResult(HandleFileContract()) { - it.uri?.let { treeUri -> - AppConfig.defaultBookTreeUri = treeUri.toString() - intent.data?.let { uri -> + intent.data?.let { uri -> + it.uri?.let { treeUri -> + AppConfig.defaultBookTreeUri = treeUri.toString() importBook(treeUri, uri) + } ?: let { + toastOnUi("不选择文件夹重启应用后可能没有权限访问") + viewModel.importBook(uri) } - } ?: finish() + } } override val binding by viewBinding(ActivityTranslucenceBinding::inflate)