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