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

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

Loading…
Cancel
Save