From 43530e2246fca090ad93ab0950cf9fada7dd0108 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 16 Aug 2019 07:59:02 +0800 Subject: [PATCH] up --- app/src/main/AndroidManifest.xml | 2 +- ...{MediaButtonIntentReceiver.kt => MediaButtonReceiver.kt} | 4 ++-- app/src/main/java/io/legado/app/service/ReadAloudService.kt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename app/src/main/java/io/legado/app/receiver/{MediaButtonIntentReceiver.kt => MediaButtonReceiver.kt} (92%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b30a3d6ff..225fe2ea1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -64,7 +64,7 @@ - + diff --git a/app/src/main/java/io/legado/app/receiver/MediaButtonIntentReceiver.kt b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt similarity index 92% rename from app/src/main/java/io/legado/app/receiver/MediaButtonIntentReceiver.kt rename to app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt index 829a4d40d..9b6d62035 100644 --- a/app/src/main/java/io/legado/app/receiver/MediaButtonIntentReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt @@ -11,10 +11,10 @@ import android.view.KeyEvent * 监听耳机键 */ -class MediaButtonIntentReceiver : BroadcastReceiver() { +class MediaButtonReceiver : BroadcastReceiver() { companion object { - val TAG = MediaButtonIntentReceiver::class.java.simpleName + val TAG = MediaButtonReceiver::class.java.simpleName fun handleIntent(context: Context, intent: Intent): Boolean { val intentAction = intent.action 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 d2f2506b3..bc798a77b 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -18,7 +18,7 @@ import io.legado.app.constant.AppConst import io.legado.app.constant.Bus import io.legado.app.constant.Status import io.legado.app.help.PendingIntentHelp -import io.legado.app.receiver.MediaButtonIntentReceiver +import io.legado.app.receiver.MediaButtonReceiver import io.legado.app.utils.postEvent import io.legado.app.utils.toast import kotlinx.coroutines.launch @@ -140,7 +140,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage * 初始化MediaSession */ private fun initMediaSession() { - val mComponent = ComponentName(packageName, MediaButtonIntentReceiver::class.java.name) + val mComponent = ComponentName(packageName, MediaButtonReceiver::class.java.name) val mediaButtonIntent = Intent(Intent.ACTION_MEDIA_BUTTON) mediaButtonIntent.component = mComponent val mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast( @@ -151,7 +151,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage mediaSessionCompat = MediaSessionCompat(this, tag, mComponent, mediaButtonReceiverPendingIntent) mediaSessionCompat?.setCallback(object : MediaSessionCompat.Callback() { override fun onMediaButtonEvent(mediaButtonEvent: Intent): Boolean { - return MediaButtonIntentReceiver.handleIntent(this@ReadAloudService, mediaButtonEvent) + return MediaButtonReceiver.handleIntent(this@ReadAloudService, mediaButtonEvent) } }) mediaSessionCompat?.setMediaButtonReceiver(mediaButtonReceiverPendingIntent)