From 3abdcb83dce65ce89db4157da5f59e5c51ca8d20 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 Sep 2019 17:47:30 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/service/BaseReadAloudService.kt | 4 +++- .../main/java/io/legado/app/service/TTSReadAloudService.kt | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index 24f82da67..6a9feb3e4 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -199,6 +199,8 @@ abstract class BaseReadAloudService : BaseService(), open fun pauseReadAloud(pause: Boolean) { postEvent(Bus.ALOUD_STATE, Status.PAUSE) this.pause = pause + upNotification() + upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED) } @CallSuper @@ -341,7 +343,7 @@ abstract class BaseReadAloudService : BaseService(), /** * 更新通知 */ - fun upNotification() { + private fun upNotification() { var nTitle: String = when { pause -> getString(R.string.read_aloud_pause) timeMinute in 1..60 -> getString( diff --git a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt index 8c7e75dfb..7f0ea7e0b 100644 --- a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt @@ -3,7 +3,6 @@ package io.legado.app.service import android.os.Build import android.speech.tts.TextToSpeech import android.speech.tts.UtteranceProgressListener -import android.support.v4.media.session.PlaybackStateCompat import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.constant.Bus @@ -134,8 +133,6 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener override fun pauseReadAloud(pause: Boolean) { super.pauseReadAloud(pause) textToSpeech?.stop() - upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED) - upNotification() } /**