pull/1612/head
kunfei 3 years ago
parent 1d54332e4d
commit b0f82513fb
  1. 1
      app/src/main/java/io/legado/app/model/ReadBook.kt
  2. 1
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt
  3. 5
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt

@ -215,7 +215,6 @@ object ReadBook : CoroutineScope by MainScope() {
*/
fun readAloud(play: Boolean = true) {
book?.let {
ReadAloud.upReadAloudClass()
ReadAloud.play(appCtx, play)
}
}

@ -86,6 +86,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
LifecycleHelp.isExistActivity(AudioPlayActivity::class.java) ->
postEvent(EventBus.MEDIA_BUTTON, true)
else -> if (AppConfig.mediaButtonOnExit || LifecycleHelp.activitySize() > 0 || !isMediaKey) {
ReadAloud.upReadAloudClass()
if (ReadBook.book != null) {
ReadBook.readAloud()
} else {

@ -863,7 +863,10 @@ class ReadBookActivity : BaseReadBookActivity(),
override fun onClickReadAloud() {
autoPageStop()
when {
!BaseReadAloudService.isRun -> ReadBook.readAloud()
!BaseReadAloudService.isRun -> {
ReadAloud.upReadAloudClass()
ReadBook.readAloud()
}
BaseReadAloudService.pause -> ReadAloud.resume(this)
else -> ReadAloud.pause(this)
}

@ -105,6 +105,7 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
tvFooterLeft.setOnClickListener {
ReadBook.book?.setTtsEngine(ttsEngine)
callBack.upSpeakEngineSummary()
ReadAloud.upReadAloudClass()
dismissAllowingStateLoss()
}
tvOk.setText(R.string.general)
@ -112,6 +113,7 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
tvOk.setOnClickListener {
ReadBook.book?.setTtsEngine(null)
AppConfig.ttsEngine = ttsEngine
ReadAloud.upReadAloudClass()
dismissAllowingStateLoss()
}
tvCancel.visible()

Loading…
Cancel
Save