Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Aug 25, 2024
1 parent 8c989be commit ed2ab8e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import java.io.File
import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.FileOutputStream
import kotlin.math.max

/**
* 阅读界面数据处理
Expand Down Expand Up @@ -113,8 +114,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
return
}
ReadBook.upMsg(null)
if (ReadBook.durChapterIndex > ReadBook.simulatedChapterSize - 1) {
ReadBook.durChapterIndex = ReadBook.simulatedChapterSize - 1
val maxChapterSize = max(0, ReadBook.simulatedChapterSize - 1)
if (ReadBook.durChapterIndex > maxChapterSize) {
ReadBook.durChapterIndex = maxChapterSize
}
if (!isSameBook) {
ReadBook.loadContent(resetPageOffset = true)
Expand Down

0 comments on commit ed2ab8e

Please sign in to comment.