This commit is contained in:
Horis 2024-05-18 00:04:54 +08:00
parent 9e5cefc47c
commit 0d63180dd0
2 changed files with 4 additions and 1 deletions

View File

@ -93,7 +93,7 @@ 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).coerceAtLeast(0) durChapterIndex = book.durChapterIndex
durChapterPos = book.durChapterPos durChapterPos = book.durChapterPos
isLocalBook = book.isLocal isLocalBook = book.isLocal
clearTextChapter() clearTextChapter()

View File

@ -116,6 +116,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
ReadBook.loadOrUpContent() ReadBook.loadOrUpContent()
checkLocalBookFileExist(book) checkLocalBookFileExist(book)
} else { } else {
if (ReadBook.durChapterIndex > ReadBook.chapterSize - 1) {
ReadBook.durChapterIndex = ReadBook.chapterSize - 1
}
ReadBook.loadContent(resetPageOffset = false) ReadBook.loadContent(resetPageOffset = false)
checkLocalBookFileExist(book) checkLocalBookFileExist(book)
} }