Created
January 29, 2023 12:19
-
-
Save ademirqueiroga/9cbfc75cc779852b3045c30abca76f5f to your computer and use it in GitHub Desktop.
PlaybackVideoFragment onKeyInterceptListener
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
setOnKeyInterceptListener { view, keyCode, event -> | |
if (isControlsOverlayVisible || event.repeatCount > 0) { | |
isShowOrHideControlsOverlayOnUserInteraction = true | |
} else when (keyCode) { | |
KeyEvent.KEYCODE_DPAD_RIGHT -> { | |
isShowOrHideControlsOverlayOnUserInteraction = event.action != KeyEvent.ACTION_DOWN | |
if (event.action == KeyEvent.ACTION_DOWN) { | |
animateIndicator(fastForwardIndicatorView) | |
} | |
} | |
KeyEvent.KEYCODE_DPAD_LEFT -> { | |
isShowOrHideControlsOverlayOnUserInteraction = event.action != KeyEvent.ACTION_DOWN | |
if (event.action == KeyEvent.ACTION_DOWN) { | |
animateIndicator(rewindIndicatorView) | |
} | |
} | |
} | |
transportControlGlue.onKey(view, keyCode, event) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment