|
|
@ -220,15 +220,17 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun openChapter(index: Int, durChapterPos: Int = 0, success: (() -> Unit)? = null) { |
|
|
|
fun openChapter(index: Int, durChapterPos: Int = 0, success: (() -> Unit)? = null) { |
|
|
|
ReadBook.clearTextChapter() |
|
|
|
if (index < ReadBook.chapterSize) { |
|
|
|
ReadBook.callBack?.upContent() |
|
|
|
ReadBook.clearTextChapter() |
|
|
|
if (index != ReadBook.durChapterIndex) { |
|
|
|
ReadBook.callBack?.upContent() |
|
|
|
ReadBook.durChapterIndex = index |
|
|
|
if (index != ReadBook.durChapterIndex) { |
|
|
|
ReadBook.durChapterPos = durChapterPos |
|
|
|
ReadBook.durChapterIndex = index |
|
|
|
} |
|
|
|
ReadBook.durChapterPos = durChapterPos |
|
|
|
ReadBook.saveRead() |
|
|
|
} |
|
|
|
ReadBook.loadContent(resetPageOffset = true) { |
|
|
|
ReadBook.saveRead() |
|
|
|
success?.invoke() |
|
|
|
ReadBook.loadContent(resetPageOffset = true) { |
|
|
|
|
|
|
|
success?.invoke() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|