|
|
|
@ -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<BookChapter> { |
|
|
|
|
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<BookChapter> { |
|
|
|
|
private fun getChapterList(): ArrayList<BookChapter> { |
|
|
|
|
val chapterList = ArrayList<BookChapter>() |
|
|
|
|
epubBook?.let { eBook -> |
|
|
|
|
val metadata = eBook.metadata |
|
|
|
|