pull/48/head
kunfei 5 years ago
parent 121d4a5cad
commit abd9d16e05
  1. 21
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  2. 21
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -207,12 +207,23 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
private fun selectFile() { private fun selectFile() {
FileChooserDialog.show( FileChooserDialog.show(
supportFragmentManager, importSource, supportFragmentManager, importSource,
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json"),
menus = arrayOf(getString(R.string.sys_file_picker))
) )
// val intent = Intent(Intent.ACTION_GET_CONTENT) }
// intent.addCategory(Intent.CATEGORY_OPENABLE)
// intent.type = "text/*"//设置类型 private fun selectFileSys() {
// startActivityForResult(intent, importSource) val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "text/*"//设置类型
startActivityForResult(intent, importSource)
}
override fun onMenuClick(menu: String) {
super.onMenuClick(menu)
when (menu) {
getString(R.string.sys_file_picker) -> selectFileSys()
}
} }
override fun onFilePicked(requestCode: Int, currentPath: String) { override fun onFilePicked(requestCode: Int, currentPath: String) {

@ -194,12 +194,23 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
private fun selectFile() { private fun selectFile() {
FileChooserDialog.show( FileChooserDialog.show(
supportFragmentManager, importSource, supportFragmentManager, importSource,
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json"),
menus = arrayOf(getString(R.string.sys_file_picker))
) )
// val intent = Intent(Intent.ACTION_GET_CONTENT) }
// intent.addCategory(Intent.CATEGORY_OPENABLE)
// intent.type = "text/*"//设置类型 private fun selectFileSys() {
// startActivityForResult(intent, importSource) val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "text/*"//设置类型
startActivityForResult(intent, importSource)
}
override fun onMenuClick(menu: String) {
super.onMenuClick(menu)
when (menu) {
getString(R.string.sys_file_picker) -> selectFileSys()
}
} }
override fun onFilePicked(requestCode: Int, currentPath: String) { override fun onFilePicked(requestCode: Int, currentPath: String) {

Loading…
Cancel
Save