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) {
val intent = Intent(context, AudioPlayService::class.java)
intent.action = Action.moveTo
intent.putExtra("index", index)
context.startService(intent)
}
}

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

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

@ -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()
}
}

@ -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" -> {

Loading…
Cancel
Save