From e0a3f831c77de4e673740fbadc08b9377f1371c8 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Wed, 1 Jun 2022 10:36:14 +0800 Subject: [PATCH] feat(epub): support titlepage.xhtml cover --- .../main/java/io/legado/app/model/localBook/EpubFile.kt | 9 +++++++++ 1 file changed, 9 insertions(+) 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 a454da48d..529a9d2a0 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 @@ -121,6 +121,14 @@ class EpubFile(var book: Book) { } private fun getContent(chapter: BookChapter): String? { + /** + * + * + * titlepage.xhtml + */ + if (chapter.url == "titlepage.xhtml") { + return "" + } /*获取当前章节文本*/ epubBook?.let { epubBook -> val nextUrl = chapter.getVariable("nextUrl") @@ -188,6 +196,7 @@ class EpubFile(var book: Book) { } private fun getImage(href: String): InputStream? { + if (href == "cover.jpg") return epubBook?.coverImage?.inputStream val abHref = href.replace("../", "") return epubBook?.resources?.getByHref(abHref)?.inputStream }