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)