pull/34/head
kunfei 5 years ago
parent c0779256e2
commit 3abdcb83dc
  1. 4
      app/src/main/java/io/legado/app/service/BaseReadAloudService.kt
  2. 3
      app/src/main/java/io/legado/app/service/TTSReadAloudService.kt

@ -199,6 +199,8 @@ abstract class BaseReadAloudService : BaseService(),
open fun pauseReadAloud(pause: Boolean) { open fun pauseReadAloud(pause: Boolean) {
postEvent(Bus.ALOUD_STATE, Status.PAUSE) postEvent(Bus.ALOUD_STATE, Status.PAUSE)
this.pause = pause this.pause = pause
upNotification()
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED)
} }
@CallSuper @CallSuper
@ -341,7 +343,7 @@ abstract class BaseReadAloudService : BaseService(),
/** /**
* 更新通知 * 更新通知
*/ */
fun upNotification() { private fun upNotification() {
var nTitle: String = when { var nTitle: String = when {
pause -> getString(R.string.read_aloud_pause) pause -> getString(R.string.read_aloud_pause)
timeMinute in 1..60 -> getString( timeMinute in 1..60 -> getString(

@ -3,7 +3,6 @@ package io.legado.app.service
import android.os.Build import android.os.Build
import android.speech.tts.TextToSpeech import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener import android.speech.tts.UtteranceProgressListener
import android.support.v4.media.session.PlaybackStateCompat
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.constant.Bus import io.legado.app.constant.Bus
@ -134,8 +133,6 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
override fun pauseReadAloud(pause: Boolean) { override fun pauseReadAloud(pause: Boolean) {
super.pauseReadAloud(pause) super.pauseReadAloud(pause)
textToSpeech?.stop() textToSpeech?.stop()
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED)
upNotification()
} }
/** /**

Loading…
Cancel
Save