pull/32/head
kunfei 5 years ago
parent c22c45fec4
commit d2c64f9847
  1. 6
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt

@ -28,23 +28,19 @@ class MediaButtonReceiver : BroadcastReceiver() {
val keycode = event.keyCode val keycode = event.keyCode
val action = event.action val action = event.action
var command = false
when (keycode) { when (keycode) {
KeyEvent.KEYCODE_MEDIA_STOP, KeyEvent.KEYCODE_MEDIA_STOP,
KeyEvent.KEYCODE_MEDIA_PAUSE, KeyEvent.KEYCODE_MEDIA_PAUSE,
KeyEvent.KEYCODE_MEDIA_PLAY, KeyEvent.KEYCODE_MEDIA_PLAY,
KeyEvent.KEYCODE_HEADSETHOOK, KeyEvent.KEYCODE_HEADSETHOOK,
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> { KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> {
command = true
}
}
if (command) {
if (action == KeyEvent.ACTION_DOWN) { if (action == KeyEvent.ACTION_DOWN) {
readAloud(context) readAloud(context)
return true return true
} }
} }
} }
}
return false return false
} }

Loading…
Cancel
Save