pull/1397/head
gedoor 3 years ago
parent e08cfd196a
commit 502cef4b04
  1. 18
      app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt

@ -33,16 +33,14 @@ class HandleFileActivity :
private val selectDocTree =
registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri ->
uri ?: let {
finish()
return@registerForActivityResult
}
if (uri.isContentScheme()) {
val modeFlags =
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
contentResolver.takePersistableUriPermission(uri, modeFlags)
}
onResult(Intent().setData(uri))
uri?.let {
if (uri.isContentScheme()) {
val modeFlags =
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
contentResolver.takePersistableUriPermission(uri, modeFlags)
}
onResult(Intent().setData(uri))
} ?: finish()
}
private val selectDoc = registerForActivityResult(ActivityResultContracts.OpenDocument()) {

Loading…
Cancel
Save