From d2c64f98474cca5f0c9ff4da3c8dd84232bb0393 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 2 Sep 2019 08:44:52 +0800 Subject: [PATCH] up --- .../io/legado/app/receiver/MediaButtonReceiver.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 da5e22f2b..99d838494 100644 --- a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt @@ -28,20 +28,16 @@ class MediaButtonReceiver : BroadcastReceiver() { 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 -> { - command = true - } - } - if (command) { - if (action == KeyEvent.ACTION_DOWN) { - readAloud(context) - return true + if (action == KeyEvent.ACTION_DOWN) { + readAloud(context) + return true + } } } }