From 852ec98e09f4d5c1ff719bfc8ce636db73bd7ee4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 30 Nov 2019 18:26:00 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/service/help/ReadBook.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/service/help/ReadBook.kt index ba8f05a58..2e601b51d 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/service/help/ReadBook.kt @@ -14,10 +14,8 @@ import io.legado.app.service.BaseReadAloudService import io.legado.app.ui.book.read.ReadBookViewModel import io.legado.app.ui.widget.page.ChapterProvider import io.legado.app.ui.widget.page.TextChapter -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch +import kotlinx.coroutines.* +import kotlinx.coroutines.Dispatchers.Main object ReadBook { @@ -219,7 +217,7 @@ object ReadBook { book!!.useReplaceRule ) when (chapter.index) { - durChapterIndex -> launch { + durChapterIndex -> withContext(Main) { curTextChapter = ChapterProvider .getTextChapter(chapter, c, chapterSize) callBack?.upContent() @@ -227,12 +225,12 @@ object ReadBook { curPageChanged() callBack?.contentLoadFinish() } - durChapterIndex - 1 -> launch { + durChapterIndex - 1 -> withContext(Main) { prevTextChapter = ChapterProvider .getTextChapter(chapter, c, chapterSize) callBack?.upContent(-1) } - durChapterIndex + 1 -> launch { + durChapterIndex + 1 -> withContext(Main) { nextTextChapter = ChapterProvider .getTextChapter(chapter, c, chapterSize) callBack?.upContent(1)