From eeb611fd057a56fcaa17afd6fa1adb54d7dcc774 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 11 Jul 2020 10:22:29 +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/model/localBook/EPUBFile.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 6bdfd5b64..84876de18 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 @@ -21,7 +21,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { private var eFile: EPUBFile? = null @Synchronized - fun getEFile(book: io.legado.app.data.entities.Book): EPUBFile { + private fun getEFile(book: io.legado.app.data.entities.Book): EPUBFile { if (eFile == null || eFile?.book?.bookUrl != book.bookUrl) { eFile = EPUBFile(book) return eFile!! @@ -29,10 +29,12 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { return eFile!! } + @Synchronized fun getChapterList(book: io.legado.app.data.entities.Book): ArrayList { return getEFile(book).getChapterList() } + @Synchronized fun getContent(book: io.legado.app.data.entities.Book, chapter: BookChapter): String? { return getEFile(book).getContent(chapter) } @@ -55,7 +57,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { } } - fun getContent(chapter: BookChapter): String? { + private fun getContent(chapter: BookChapter): String? { epubBook?.let { eBook -> val resource = eBook.resources.getByHref(chapter.url) val content = StringBuilder() @@ -82,7 +84,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { return null } - fun getChapterList(): ArrayList { + private fun getChapterList(): ArrayList { val chapterList = ArrayList() epubBook?.let { eBook -> val metadata = eBook.metadata