From 82b442f2298eb719c7ae09a287db5218bdc0cd5b Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 1 Oct 2021 00:59:26 +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 --- .../main/java/io/legado/app/service/DownloadService.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/DownloadService.kt b/app/src/main/java/io/legado/app/service/DownloadService.kt index 7307f1cc0..3d2e8e6c2 100644 --- a/app/src/main/java/io/legado/app/service/DownloadService.kt +++ b/app/src/main/java/io/legado/app/service/DownloadService.kt @@ -176,14 +176,11 @@ class DownloadService : BaseService() { val intent = Intent() intent.action = Intent.ACTION_VIEW intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //7.0版本以上 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + //7.0版本以上 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - intent.setDataAndType(uri, IntentType.from(uri)) - } else { - intent.setDataAndType(uri, IntentType.from(uri)) } - + intent.setDataAndType(uri, IntentType.from(uri)) try { startActivity(intent) } catch (e: Exception) {