From f6303cc3548b6223f0ce2070bcb9e2ee52e86e20 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 27 Nov 2019 14:53:10 +0800 Subject: [PATCH] up --- .../app/ui/book/read/ReadBookActivity.kt | 1 - .../app/ui/book/read/ReadBookViewModel.kt | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 6a2a00e19..f0bb7ab2a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.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() diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 0dd83e4ed..e2d581b13 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -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) + } } } }