From 5956f6032a782e3241af395124769b2c367ba471 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 10 Jul 2020 20:44:58 +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 --- app/src/main/AndroidManifest.xml | 1 + .../app/ui/book/source/manage/BookSourceActivity.kt | 2 +- .../main/java/io/legado/app/ui/filechooser/FilePicker.kt | 8 ++++---- .../io/legado/app/ui/replacerule/ReplaceRuleActivity.kt | 2 +- .../legado/app/ui/rss/source/manage/RssSourceActivity.kt | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0bcfbc414..03a8398b5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -301,6 +301,7 @@ + diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index d5feb380c..9b6b8a5d4 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -91,7 +91,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity .selectFile( this, importRequestCode, - type = "text/*", + type = arrayOf("text/*", "application/json"), allowExtensions = arrayOf("txt", "json") ) R.id.menu_import_source_onLine -> showImportDialog() diff --git a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt b/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt index 717ad8f11..0fc917af8 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt +++ b/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt @@ -91,7 +91,7 @@ object FilePicker { activity: BaseActivity, requestCode: Int, title: String = activity.getString(R.string.select_file), - type: String, + type: Array, allowExtensions: Array?, default: (() -> Unit)? = null ) { @@ -107,7 +107,7 @@ object FilePicker { 1 -> { try { val intent = createSelectFileIntent() - intent.type = type//设置类型 + intent.putExtra(Intent.EXTRA_MIME_TYPES, type) activity.startActivityForResult(intent, requestCode) } catch (e: java.lang.Exception) { e.printStackTrace() @@ -131,7 +131,7 @@ object FilePicker { fragment: Fragment, requestCode: Int, title: String = fragment.getString(R.string.select_file), - type: String, + type: Array, allowExtensions: Array, default: (() -> Unit)? = null ) { @@ -148,7 +148,7 @@ object FilePicker { 1 -> { try { val intent = createSelectFileIntent() - intent.type = type//设置类型 + intent.putExtra(Intent.EXTRA_MIME_TYPES, type) fragment.startActivityForResult(intent, requestCode) } catch (e: java.lang.Exception) { e.printStackTrace() diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index 1f9057e35..dd1014a59 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -190,7 +190,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi .selectFile( this, importRequestCode, - type = "text/*", + type = arrayOf("text/*", "application/json"), allowExtensions = arrayOf("txt", "json") ) } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index be9866ef2..70c01a77a 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -86,7 +86,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r .selectFile( this, importRequestCode, - type = "text/*", + type = arrayOf("text/*", "application/json"), allowExtensions = arrayOf("txt", "json") ) R.id.menu_import_source_onLine -> showImportDialog()