pull/1198/head
gedoor 3 years ago
parent 09f5953555
commit 2567829363
  1. 5
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt

@ -22,7 +22,6 @@ import io.legado.app.utils.postEvent
* Created by GKF on 2018/1/6.
* 监听耳机键
*/
class MediaButtonReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
@ -36,8 +35,8 @@ class MediaButtonReceiver : BroadcastReceiver() {
fun handleIntent(context: Context, intent: Intent): Boolean {
val intentAction = intent.action
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
val keyEvent =
intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT) ?: return false
val keyEvent = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT)
?: return false
val keycode: Int = keyEvent.keyCode
val action: Int = keyEvent.action
if (action == KeyEvent.ACTION_DOWN) {

Loading…
Cancel
Save