Created
January 4, 2019 08:28
-
-
Save michael-riha/b77f77505120aff4528c2995890d33a5 to your computer and use it in GitHub Desktop.
Listen to all dispatched events inside the Activity for Android TV - https://github.com/bitmovin/bitmovin-player-android-samples/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L116-L130 | |
@Override | |
public boolean dispatchKeyEvent(KeyEvent event) | |
{ | |
// This method is called on key down and key up, so avoid being called twice | |
if (this.bitmovinPlayerView != null && event.getAction() == KeyEvent.ACTION_DOWN) | |
{ | |
if (this.handleUserInput(event.getKeyCode())) | |
{ | |
return true; | |
} | |
} | |
// Make sure to return super.dispatchKeyEvent(event) so that any key not handled yet will work as expected | |
return super.dispatchKeyEvent(event); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment