|
|
@ -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) { |
|
|
|