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