pull/49/head
kunfei 5 years ago
parent 6381b8d1b6
commit f6303cc354
  1. 1
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 33
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -375,7 +375,6 @@ class ReadBookActivity : BaseActivity(R.layout.activity_book_read),
*/
override fun moveToNextChapter(upContent: Boolean): Boolean {
return if (ReadBookViewModel.durChapterIndex < ReadBookViewModel.chapterSize - 1) {
ReadBookViewModel.durPageIndex = 0
ReadBookViewModel.moveToNextChapter(upContent)
ReadBookViewModel.saveRead()
curChapterChanged()

@ -115,21 +115,24 @@ object ReadBookViewModel {
}
fun moveToNextChapter(upContent: Boolean) {
durChapterIndex++
prevTextChapter = curTextChapter
curTextChapter = nextTextChapter
nextTextChapter = null
book?.let {
if (curTextChapter == null) {
loadContent(durChapterIndex)
} else if (upContent) {
callBack?.upContent()
}
loadContent(durChapterIndex.plus(1))
GlobalScope.launch(IO) {
for (i in 2..10) {
delay(100)
download(durChapterIndex + i)
if (durChapterIndex < chapterSize - 1) {
durPageIndex = 0
durChapterIndex++
prevTextChapter = curTextChapter
curTextChapter = nextTextChapter
nextTextChapter = null
book?.let {
if (curTextChapter == null) {
loadContent(durChapterIndex)
} else if (upContent) {
callBack?.upContent()
}
loadContent(durChapterIndex.plus(1))
GlobalScope.launch(IO) {
for (i in 2..10) {
delay(100)
download(durChapterIndex + i)
}
}
}
}

Loading…
Cancel
Save