From c22c45fec4156d2357a1aef72fc06d1031800502 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 2 Sep 2019 08:42:59 +0800 Subject: [PATCH] up --- .../java/io/legado/app/receiver/MediaButtonReceiver.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt index b61cbde76..da5e22f2b 100644 --- a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt @@ -22,14 +22,19 @@ class MediaButtonReceiver : BroadcastReceiver() { fun handleIntent(context: Context, intent: Intent): Boolean { val intentAction = intent.action if (Intent.ACTION_MEDIA_BUTTON == intentAction) { - val event = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT) ?: return false + val event = + intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT) ?: return false val keycode = event.keyCode val action = event.action var command = false when (keycode) { - KeyEvent.KEYCODE_MEDIA_STOP, KeyEvent.KEYCODE_MEDIA_PAUSE, KeyEvent.KEYCODE_MEDIA_PLAY, KeyEvent.KEYCODE_HEADSETHOOK, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> { + KeyEvent.KEYCODE_MEDIA_STOP, + KeyEvent.KEYCODE_MEDIA_PAUSE, + KeyEvent.KEYCODE_MEDIA_PLAY, + KeyEvent.KEYCODE_HEADSETHOOK, + KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> { command = true } }