|
|
@ -28,20 +28,16 @@ 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 (action == KeyEvent.ACTION_DOWN) { |
|
|
|
} |
|
|
|
readAloud(context) |
|
|
|
} |
|
|
|
return true |
|
|
|
if (command) { |
|
|
|
} |
|
|
|
if (action == KeyEvent.ACTION_DOWN) { |
|
|
|
|
|
|
|
readAloud(context) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|