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 { override fun moveToNextChapter(upContent: Boolean): Boolean {
return if (ReadBookViewModel.durChapterIndex < ReadBookViewModel.chapterSize - 1) { return if (ReadBookViewModel.durChapterIndex < ReadBookViewModel.chapterSize - 1) {
ReadBookViewModel.durPageIndex = 0
ReadBookViewModel.moveToNextChapter(upContent) ReadBookViewModel.moveToNextChapter(upContent)
ReadBookViewModel.saveRead() ReadBookViewModel.saveRead()
curChapterChanged() curChapterChanged()

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

Loading…
Cancel
Save