From ef949bfdfa6bc3c2aa5f599da609619318aa661e Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 30 Nov 2019 18:55:15 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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 be1644ca0..72ae16701 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 @@ -497,13 +497,15 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo page_view.upContent() } } - observeEvent(Bus.TTS_START) { chapterStart -> + observeEventSticky(Bus.TTS_START) { chapterStart -> launch(IO) { - ReadBook.curTextChapter?.let { - val pageStart = chapterStart - it.getReadLength(ReadBook.durPageIndex) - it.page(ReadBook.durPageIndex)?.upPageAloudSpan(pageStart) - withContext(Main) { - page_view.upContent() + if (BaseReadAloudService.isPlay()) { + ReadBook.curTextChapter?.let { + val pageStart = chapterStart - it.getReadLength(ReadBook.durPageIndex) + it.page(ReadBook.durPageIndex)?.upPageAloudSpan(pageStart) + withContext(Main) { + page_view.upContent() + } } } }