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)