|
@@ -90,7 +90,9 @@ object ReadBook : CoroutineScope by MainScope() {
|
|
|
readRecord.readTime = appDb.readRecordDao.getReadTime(book.name) ?: 0
|
|
readRecord.readTime = appDb.readRecordDao.getReadTime(book.name) ?: 0
|
|
|
chapterSize = appDb.bookChapterDao.getChapterCount(book.bookUrl)
|
|
chapterSize = appDb.bookChapterDao.getChapterCount(book.bookUrl)
|
|
|
contentProcessor = ContentProcessor.get(book)
|
|
contentProcessor = ContentProcessor.get(book)
|
|
|
- durChapterIndex = min(book.durChapterIndex, chapterSize - 1)
|
|
|
|
|
|
|
+ if (chapterSize > 0) {
|
|
|
|
|
+ durChapterIndex = min(book.durChapterIndex, chapterSize - 1)
|
|
|
|
|
+ }
|
|
|
durChapterPos = book.durChapterPos
|
|
durChapterPos = book.durChapterPos
|
|
|
isLocalBook = book.isLocal
|
|
isLocalBook = book.isLocal
|
|
|
clearTextChapter()
|
|
clearTextChapter()
|
|
@@ -533,20 +535,17 @@ object ReadBook : CoroutineScope by MainScope() {
|
|
|
0 -> {
|
|
0 -> {
|
|
|
curTextChapter?.cancelLayout()
|
|
curTextChapter?.cancelLayout()
|
|
|
curTextChapter = textChapter
|
|
curTextChapter = textChapter
|
|
|
- if (resetPageOffset) {
|
|
|
|
|
- callBack?.resetPageOffset()
|
|
|
|
|
- }
|
|
|
|
|
callBack?.upMenuView()
|
|
callBack?.upMenuView()
|
|
|
textChapter.setProgressListener(object : LayoutProgressListener {
|
|
textChapter.setProgressListener(object : LayoutProgressListener {
|
|
|
var available = false
|
|
var available = false
|
|
|
|
|
|
|
|
override fun onLayoutPageCompleted(index: Int, page: TextPage) {
|
|
override fun onLayoutPageCompleted(index: Int, page: TextPage) {
|
|
|
if (!available && page.containPos(durChapterPos)) {
|
|
if (!available && page.containPos(durChapterPos)) {
|
|
|
- curPageChanged()
|
|
|
|
|
- callBack?.contentLoadFinish()
|
|
|
|
|
if (upContent) {
|
|
if (upContent) {
|
|
|
callBack?.upContent(offset, resetPageOffset)
|
|
callBack?.upContent(offset, resetPageOffset)
|
|
|
}
|
|
}
|
|
|
|
|
+ curPageChanged()
|
|
|
|
|
+ callBack?.contentLoadFinish()
|
|
|
available = true
|
|
available = true
|
|
|
}
|
|
}
|
|
|
if (upContent && isScroll) {
|
|
if (upContent && isScroll) {
|
|
@@ -742,8 +741,6 @@ object ReadBook : CoroutineScope by MainScope() {
|
|
|
fun upPageAnim()
|
|
fun upPageAnim()
|
|
|
|
|
|
|
|
fun notifyBookChanged()
|
|
fun notifyBookChanged()
|
|
|
-
|
|
|
|
|
- fun resetPageOffset()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|