Skip to content

Instantly share code, notes, and snippets.

@ademirqueiroga
Created January 29, 2023 12:19
Show Gist options
  • Save ademirqueiroga/9cbfc75cc779852b3045c30abca76f5f to your computer and use it in GitHub Desktop.
Save ademirqueiroga/9cbfc75cc779852b3045c30abca76f5f to your computer and use it in GitHub Desktop.
PlaybackVideoFragment onKeyInterceptListener
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