From 3846a02923199604c4104cb16a5a7434583efd4e Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Thu, 19 Jan 2023 19:59:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/association/FileAssociationActivity.kt | 6 +++--- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 4 +++- 2 files changed, 6 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 bd3e04b41..52a62ca68 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 @@ -107,15 +107,15 @@ class FileAssociationActivity : intent.data?.let { data -> if (data.isContentScheme()) { viewModel.dispatchIndent(data) - } else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) { + } else { PermissionsCompat.Builder(this) .addPermissions(*Permissions.Group.STORAGE) .rationale(R.string.tip_perm_request_storage) .onGranted { viewModel.dispatchIndent(data) + }.onDenied { + toastOnUi("请求存储权限失败。") }.request() - } else { - toastOnUi("由于安卓系统限制,请使用系统文件管理重新打开。") } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 11558542d..bbb977c3c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -1304,7 +1304,9 @@ class ReadBookActivity : BaseReadBookActivity(), popupAction.dismiss() binding.readView.onDestroy() ReadBook.msg = null - ReadBook.callBack = null + if (ReadBook.callBack === this) { + ReadBook.callBack = null + } if (!BuildConfig.DEBUG) { Backup.autoBack(this) }