From a9e538572da24e6a3e73b37e886d0b58a9f3ba57 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 7 Dec 2020 19:48:30 +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 --- app/src/main/java/io/legado/app/service/help/AudioPlay.kt | 6 ++++++ .../main/java/io/legado/app/ui/audio/AudioPlayActivity.kt | 3 +++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/io/legado/app/service/help/AudioPlay.kt b/app/src/main/java/io/legado/app/service/help/AudioPlay.kt index 87549c8eb..9ebc544c8 100644 --- a/app/src/main/java/io/legado/app/service/help/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/service/help/AudioPlay.kt @@ -131,6 +131,12 @@ object AudioPlay { } } + fun addTimer(context: Context) { + val intent = Intent(context, AudioPlayService::class.java) + intent.action = IntentAction.addTimer + context.startService(intent) + } + fun saveRead() { Coroutine.async { book?.let { book -> diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt index 93727fb8d..76a60f6bb 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt @@ -115,6 +115,9 @@ class AudioPlayActivity : binding.ivFastRewind.onClick { AudioPlay.adjustSpeed(this, -0.1f) } + binding.ivTimer.onClick { + AudioPlay.addTimer(this) + } } private fun upCover(path: String?) {