From f5ad6aba7ff09438d1b4ccd6e9a8c89ba8e84d83 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 28 Aug 2019 20:17:11 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/service/ReadAloudService.kt | 8 ++------ .../java/io/legado/app/ui/readbook/ReadBookActivity.kt | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/ReadAloudService.kt b/app/src/main/java/io/legado/app/service/ReadAloudService.kt index 88930eb03..4c50925b8 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -327,18 +327,14 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage when (focusChange) { AudioManager.AUDIOFOCUS_GAIN -> { // 重新获得焦点, 可做恢复播放,恢复后台音量的操作 - if (!pause) { - resumeReadAloud() - } + if (!pause) resumeReadAloud() } AudioManager.AUDIOFOCUS_LOSS -> { // 永久丢失焦点除非重新主动获取,这种情况是被其他播放器抢去了焦点, 为避免与其他播放器混音,可将音乐暂停 } AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> { // 暂时丢失焦点,这种情况是被其他应用申请了短暂的焦点,可压低后台音量 - if (!pause) { - pauseReadAloud(false) - } + if (!pause) pauseReadAloud(false) } AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> { // 短暂丢失焦点,这种情况是被其他应用申请了短暂的焦点希望其他声音能压低音量(或者关闭声音)凸显这个声音(比如短信提示音), diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index d7507a57c..7151fbe13 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -440,7 +440,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea super.observeLiveBus() observeEvent(Bus.ALOUD_STATE) { readAloudStatus = it - if (it == Status.STOP) { + if (it == Status.STOP || it == Status.PAUSE) { viewModel.curTextChapter?.let { textChapter -> val page = textChapter.page(viewModel.durPageIndex) if (page != null && page.text is SpannableStringBuilder) {