From c9cc9a617874c188deb8253f928c6efc57187c6d Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 2 Feb 2020 21:19:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/help/BookHelp.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 2f916adbe..0cdb7e1e8 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/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 }