From a2fa8e1adb2631132fecec2130fe07c22cb16a02 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 Sep 2019 10:19:24 +0800 Subject: [PATCH] up --- .../java/io/legado/app/service/ReadAloudService.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/ReadAloudService.kt b/app/src/main/java/io/legado/app/service/ReadAloudService.kt index 1af82c149..baa368760 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -325,12 +325,14 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, * 初始化MediaSession, 注册多媒体按钮 */ private fun initMediaSession() { - val mComponent = ComponentName(packageName, MediaButtonReceiver::class.java.name) - val mediaButtonIntent = Intent(Intent.ACTION_MEDIA_BUTTON) - mediaButtonIntent.component = mComponent + val mediaButtonIntent = Intent(Intent.ACTION_MEDIA_BUTTON).apply { + component = ComponentName(packageName, MediaButtonReceiver::class.java.name) + } val mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast( - this, 0, - mediaButtonIntent, PendingIntent.FLAG_CANCEL_CURRENT + this, + 0, + mediaButtonIntent, + PendingIntent.FLAG_CANCEL_CURRENT ) mediaSessionCompat = MediaSessionCompat(this, tag)