pull/84/head
kunfei 5 years ago
parent a2a0c03d53
commit c9cc9a6178
  1. 26
      app/src/main/java/io/legado/app/help/BookHelp.kt

@ -108,20 +108,26 @@ object BookHelp {
}
fun hasContent(book: Book, bookChapter: BookChapter): Boolean {
if (downloadUri.isDocumentUri(App.INSTANCE)) {
DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root ->
return DocumentUtils.exists(
root,
when {
book.isLocalBook() -> {
return true
}
downloadUri.isDocumentUri(App.INSTANCE) -> {
DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root ->
return DocumentUtils.exists(
root,
"${bookChapterName(bookChapter)}.nb",
subDirs = *arrayOf(cacheFolderName, bookFolderName(book))
)
}
}
else -> {
return FileUtils.exists(
File(downloadPath),
"${bookChapterName(bookChapter)}.nb",
subDirs = *arrayOf(cacheFolderName, bookFolderName(book))
)
}
} else {
return FileUtils.exists(
File(downloadPath),
"${bookChapterName(bookChapter)}.nb",
subDirs = *arrayOf(cacheFolderName, bookFolderName(book))
)
}
return false
}

Loading…
Cancel
Save