mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
优化
This commit is contained in:
parent
2737254fec
commit
1c2eb8ef7d
@ -113,9 +113,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
ReadBook.upMsg(null)
|
ReadBook.upMsg(null)
|
||||||
if (ReadBook.simulatedChapterSize > 0 && ReadBook.durChapterIndex > ReadBook.simulatedChapterSize - 1) {
|
ensureChapterExist()
|
||||||
ReadBook.durChapterIndex = ReadBook.simulatedChapterSize - 1
|
|
||||||
}
|
|
||||||
if (!isSameBook) {
|
if (!isSameBook) {
|
||||||
ReadBook.loadContent(resetPageOffset = true)
|
ReadBook.loadContent(resetPageOffset = true)
|
||||||
} else {
|
} else {
|
||||||
@ -150,6 +148,12 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun ensureChapterExist() {
|
||||||
|
if (ReadBook.simulatedChapterSize > 0 && ReadBook.durChapterIndex > ReadBook.simulatedChapterSize - 1) {
|
||||||
|
ReadBook.durChapterIndex = ReadBook.simulatedChapterSize - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载详情页
|
* 加载详情页
|
||||||
*/
|
*/
|
||||||
@ -170,6 +174,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
fun loadChapterList(book: Book) {
|
fun loadChapterList(book: Book) {
|
||||||
execute {
|
execute {
|
||||||
if (loadChapterListAwait(book)) {
|
if (loadChapterListAwait(book)) {
|
||||||
|
ensureChapterExist()
|
||||||
ReadBook.upMsg(null)
|
ReadBook.upMsg(null)
|
||||||
ReadBook.loadContent(resetPageOffset = true)
|
ReadBook.loadContent(resetPageOffset = true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user