pull/1403/head
gedoor 3 years ago
parent 9753d0c608
commit 8100913489
  1. 11
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt

@ -138,13 +138,14 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
lastPath.isContentScheme() -> {
val rootUri = Uri.parse(lastPath)
kotlin.runCatching {
DocumentFile.fromTreeUri(this, rootUri)?.let {
subDocs.clear()
rootDoc = FileDoc.fromDocumentFile(it)
upDocs(rootDoc!!)
} ?: let {
val doc = DocumentFile.fromTreeUri(this, rootUri)
if (doc == null || doc.name.isNullOrEmpty()) {
binding.tvEmptyMsg.visible()
selectFolder.launch(null)
} else {
subDocs.clear()
rootDoc = FileDoc.fromDocumentFile(doc)
upDocs(rootDoc!!)
}
}.onFailure {
binding.tvEmptyMsg.visible()

Loading…
Cancel
Save