From 446c74b1430ba0efc34898c6d5c39411086febea Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 9 Nov 2019 12:51:36 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/service/help/AudioPlay.kt | 1 + app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt | 4 +++- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 2 +- app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt | 4 ++-- .../legado/app/ui/book/read/config/ReadAloudConfigDialog.kt | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/help/AudioPlay.kt b/app/src/main/java/io/legado/app/service/help/AudioPlay.kt index 2520d1c90..ca6896715 100644 --- a/app/src/main/java/io/legado/app/service/help/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/service/help/AudioPlay.kt @@ -80,6 +80,7 @@ object AudioPlay { if (AudioPlayService.isRun) { val intent = Intent(context, AudioPlayService::class.java) intent.action = Action.moveTo + intent.putExtra("index", index) context.startService(intent) } } diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt index 14c2428a8..f687ec0fa 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt @@ -146,7 +146,9 @@ class AudioPlayActivity : VMBaseActivity(R.layout.activity_a override fun observeLiveBus() { observeEvent(Bus.MEDIA_BUTTON) { - playButton() + if (it) { + playButton() + } } observeEventSticky(Bus.AUDIO_STATE) { AudioPlay.status = it 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 d61e03e86..95b2151c3 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 @@ -455,7 +455,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo /** * 朗读按钮 */ - private fun onClickReadAloud() { + override fun onClickReadAloud() { if (!BaseReadAloudService.isRun) { readAloudStatus = Status.STOP SystemUtils.ignoreBatteryOptimization(this) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 4504f1dee..f0d06c7fd 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -10,7 +10,6 @@ import android.widget.SeekBar import androidx.core.view.isVisible import io.legado.app.App import io.legado.app.R -import io.legado.app.constant.Bus import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.buttonDisabledColor @@ -164,7 +163,7 @@ class ReadMenu : FrameLayout { //朗读 ll_read_aloud.onClick { runMenuOut { - postEvent(Bus.READ_ALOUD_BUTTON, true) + callBack?.onClickReadAloud() } } ll_read_aloud.onLongClick { @@ -254,6 +253,7 @@ class ReadMenu : FrameLayout { fun showMoreSetting() fun showReadAloudDialog() fun upSystemUiVisibility() + fun onClickReadAloud() } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt index 0c81d8adf..a5b1349a2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt @@ -89,7 +89,7 @@ class ReadAloudConfigDialog : DialogFragment() { when (key) { "readAloudByPage" -> { if (BaseReadAloudService.isRun) { - postEvent(Bus.READ_ALOUD_BUTTON, false) + postEvent(Bus.MEDIA_BUTTON, false) } } "readAloudOnLine" -> {