From cbd204e25d766658debca486aff473a5e3eb9611 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 21 Aug 2021 23:19:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/service/BaseReadAloudService.kt | 14 ++++++++++---- 1 file changed, 10 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 d720db43c..566d4d608 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -68,7 +68,7 @@ abstract class BaseReadAloudService : BaseService(), initBroadcastReceiver() upNotification() upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING) - doDs() + resumeDs() } override fun onDestroy() { @@ -154,9 +154,7 @@ abstract class BaseReadAloudService : BaseService(), open fun resumeReadAloud() { pause = false upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING) - if (timeMinute > 1) { - doDs() - } + resumeDs() } abstract fun upSpeechRate(reset: Boolean = false) @@ -206,6 +204,14 @@ abstract class BaseReadAloudService : BaseService(), upNotification() } + private fun resumeDs() { + if (timeMinute > 1) { + doDs() + } else { + timeMinute = 0 + } + } + /** * 定时 */