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()