pull/48/head
kunfei 5 years ago
parent bc4e782566
commit 446c74b143
  1. 1
      app/src/main/java/io/legado/app/service/help/AudioPlay.kt
  2. 4
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  4. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt

@ -80,6 +80,7 @@ object AudioPlay {
if (AudioPlayService.isRun) { if (AudioPlayService.isRun) {
val intent = Intent(context, AudioPlayService::class.java) val intent = Intent(context, AudioPlayService::class.java)
intent.action = Action.moveTo intent.action = Action.moveTo
intent.putExtra("index", index)
context.startService(intent) context.startService(intent)
} }
} }

@ -146,7 +146,9 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
override fun observeLiveBus() { override fun observeLiveBus() {
observeEvent<Boolean>(Bus.MEDIA_BUTTON) { observeEvent<Boolean>(Bus.MEDIA_BUTTON) {
playButton() if (it) {
playButton()
}
} }
observeEventSticky<Int>(Bus.AUDIO_STATE) { observeEventSticky<Int>(Bus.AUDIO_STATE) {
AudioPlay.status = it AudioPlay.status = it

@ -455,7 +455,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
/** /**
* 朗读按钮 * 朗读按钮
*/ */
private fun onClickReadAloud() { override fun onClickReadAloud() {
if (!BaseReadAloudService.isRun) { if (!BaseReadAloudService.isRun) {
readAloudStatus = Status.STOP readAloudStatus = Status.STOP
SystemUtils.ignoreBatteryOptimization(this) SystemUtils.ignoreBatteryOptimization(this)

@ -10,7 +10,6 @@ import android.widget.SeekBar
import androidx.core.view.isVisible import androidx.core.view.isVisible
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.Bus
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.buttonDisabledColor import io.legado.app.lib.theme.buttonDisabledColor
@ -164,7 +163,7 @@ class ReadMenu : FrameLayout {
//朗读 //朗读
ll_read_aloud.onClick { ll_read_aloud.onClick {
runMenuOut { runMenuOut {
postEvent(Bus.READ_ALOUD_BUTTON, true) callBack?.onClickReadAloud()
} }
} }
ll_read_aloud.onLongClick { ll_read_aloud.onLongClick {
@ -254,6 +253,7 @@ class ReadMenu : FrameLayout {
fun showMoreSetting() fun showMoreSetting()
fun showReadAloudDialog() fun showReadAloudDialog()
fun upSystemUiVisibility() fun upSystemUiVisibility()
fun onClickReadAloud()
} }
} }

@ -89,7 +89,7 @@ class ReadAloudConfigDialog : DialogFragment() {
when (key) { when (key) {
"readAloudByPage" -> { "readAloudByPage" -> {
if (BaseReadAloudService.isRun) { if (BaseReadAloudService.isRun) {
postEvent(Bus.READ_ALOUD_BUTTON, false) postEvent(Bus.MEDIA_BUTTON, false)
} }
} }
"readAloudOnLine" -> { "readAloudOnLine" -> {

Loading…
Cancel
Save