From e9035ada9b8e3f751ccf286504169bb61a117ff9 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 1 Dec 2021 19:59:24 +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 --- app/src/main/java/io/legado/app/help/BookHelp.kt | 4 ++-- app/src/main/java/io/legado/app/model/localBook/EpubFile.kt | 2 +- app/src/main/java/io/legado/app/model/localBook/LocalBook.kt | 2 +- 3 files changed, 4 insertions(+), 4 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 4dcd48bdd..f94119439 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -182,9 +182,9 @@ object BookHelp { */ fun getContent(book: Book, bookChapter: BookChapter): String? { if (book.isLocalTxt() || book.isUmd()) { - return LocalBook.getContext(book, bookChapter) + return LocalBook.getContent(book, bookChapter) } else if (book.isEpub() && !hasContent(book, bookChapter)) { - val string = LocalBook.getContext(book, bookChapter) + val string = LocalBook.getContent(book, bookChapter) string?.let { FileUtils.createFileIfNotExist( downloadDir, diff --git a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt index de38800da..71cbf3461 100644 --- a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt @@ -43,7 +43,6 @@ class EpubFile(var book: Book) { if (input != null) { FileUtils.writeInputStream(file, input) } - } return file } @@ -136,6 +135,7 @@ class EpubFile(var book: Book) { private fun getContent(chapter: BookChapter): String? { /*获取当前章节文本*/ epubBook?.let { + it.contents val body = Jsoup.parse(String(it.resources.getByHref(chapter.url).data, mCharset)).body() diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index 951c839b7..e930392c3 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -43,7 +43,7 @@ object LocalBook { return chapters } - fun getContext(book: Book, chapter: BookChapter): String? { + fun getContent(book: Book, chapter: BookChapter): String? { return when { book.isEpub() -> { EpubFile.getContent(book, chapter)