pull/274/head
gedoor 4 years ago
parent 07af514413
commit 5956f6032a
  1. 1
      app/src/main/AndroidManifest.xml
  2. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  3. 8
      app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt
  4. 2
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt
  5. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -301,6 +301,7 @@
<data android:scheme="content"/> <data android:scheme="content"/>
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain" />
<data android:mimeType="application/json" /> <data android:mimeType="application/json" />
<data android:mimeType="application/epub" />
</intent-filter> </intent-filter>
</activity> </activity>

@ -91,7 +91,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
.selectFile( .selectFile(
this, this,
importRequestCode, importRequestCode,
type = "text/*", type = arrayOf("text/*", "application/json"),
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json")
) )
R.id.menu_import_source_onLine -> showImportDialog() R.id.menu_import_source_onLine -> showImportDialog()

@ -91,7 +91,7 @@ object FilePicker {
activity: BaseActivity, activity: BaseActivity,
requestCode: Int, requestCode: Int,
title: String = activity.getString(R.string.select_file), title: String = activity.getString(R.string.select_file),
type: String, type: Array<String>,
allowExtensions: Array<String>?, allowExtensions: Array<String>?,
default: (() -> Unit)? = null default: (() -> Unit)? = null
) { ) {
@ -107,7 +107,7 @@ object FilePicker {
1 -> { 1 -> {
try { try {
val intent = createSelectFileIntent() val intent = createSelectFileIntent()
intent.type = type//设置类型 intent.putExtra(Intent.EXTRA_MIME_TYPES, type)
activity.startActivityForResult(intent, requestCode) activity.startActivityForResult(intent, requestCode)
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
e.printStackTrace() e.printStackTrace()
@ -131,7 +131,7 @@ object FilePicker {
fragment: Fragment, fragment: Fragment,
requestCode: Int, requestCode: Int,
title: String = fragment.getString(R.string.select_file), title: String = fragment.getString(R.string.select_file),
type: String, type: Array<String>,
allowExtensions: Array<String>, allowExtensions: Array<String>,
default: (() -> Unit)? = null default: (() -> Unit)? = null
) { ) {
@ -148,7 +148,7 @@ object FilePicker {
1 -> { 1 -> {
try { try {
val intent = createSelectFileIntent() val intent = createSelectFileIntent()
intent.type = type//设置类型 intent.putExtra(Intent.EXTRA_MIME_TYPES, type)
fragment.startActivityForResult(intent, requestCode) fragment.startActivityForResult(intent, requestCode)
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
e.printStackTrace() e.printStackTrace()

@ -190,7 +190,7 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi
.selectFile( .selectFile(
this, this,
importRequestCode, importRequestCode,
type = "text/*", type = arrayOf("text/*", "application/json"),
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json")
) )
} }

@ -86,7 +86,7 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
.selectFile( .selectFile(
this, this,
importRequestCode, importRequestCode,
type = "text/*", type = arrayOf("text/*", "application/json"),
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json")
) )
R.id.menu_import_source_onLine -> showImportDialog() R.id.menu_import_source_onLine -> showImportDialog()

Loading…
Cancel
Save