|
|
@ -21,7 +21,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { |
|
|
|
private var eFile: EPUBFile? = null |
|
|
|
private var eFile: EPUBFile? = null |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@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) { |
|
|
|
if (eFile == null || eFile?.book?.bookUrl != book.bookUrl) { |
|
|
|
eFile = EPUBFile(book) |
|
|
|
eFile = EPUBFile(book) |
|
|
|
return eFile!! |
|
|
|
return eFile!! |
|
|
@ -29,10 +29,12 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { |
|
|
|
return eFile!! |
|
|
|
return eFile!! |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
fun getChapterList(book: io.legado.app.data.entities.Book): ArrayList<BookChapter> { |
|
|
|
fun getChapterList(book: io.legado.app.data.entities.Book): ArrayList<BookChapter> { |
|
|
|
return getEFile(book).getChapterList() |
|
|
|
return getEFile(book).getChapterList() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
fun getContent(book: io.legado.app.data.entities.Book, chapter: BookChapter): String? { |
|
|
|
fun getContent(book: io.legado.app.data.entities.Book, chapter: BookChapter): String? { |
|
|
|
return getEFile(book).getContent(chapter) |
|
|
|
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 -> |
|
|
|
epubBook?.let { eBook -> |
|
|
|
val resource = eBook.resources.getByHref(chapter.url) |
|
|
|
val resource = eBook.resources.getByHref(chapter.url) |
|
|
|
val content = StringBuilder() |
|
|
|
val content = StringBuilder() |
|
|
@ -82,7 +84,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getChapterList(): ArrayList<BookChapter> { |
|
|
|
private fun getChapterList(): ArrayList<BookChapter> { |
|
|
|
val chapterList = ArrayList<BookChapter>() |
|
|
|
val chapterList = ArrayList<BookChapter>() |
|
|
|
epubBook?.let { eBook -> |
|
|
|
epubBook?.let { eBook -> |
|
|
|
val metadata = eBook.metadata |
|
|
|
val metadata = eBook.metadata |
|
|
|