Further double tap gesture improvements (#2988)

This commit is contained in:
Faisal Khan 2023-02-07 21:58:27 +05:30 committed by GitHub
parent 8e737afc72
commit 8017898c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,6 +118,8 @@ internal class CustomExoPlayerView(
// don't let the player view hide its controls automatically // don't let the player view hide its controls automatically
controllerShowTimeoutMs = -1 controllerShowTimeoutMs = -1
// don't let the player view show its controls automatically
controllerAutoShow = false
// locking the player // locking the player
binding.lockPlayer.setOnClickListener { binding.lockPlayer.setOnClickListener {
@ -172,6 +174,11 @@ internal class CustomExoPlayerView(
// keep screen on if the video is playing // keep screen on if the video is playing
keepScreenOn = player.isPlaying == true keepScreenOn = player.isPlaying == true
if (player.playbackState == Player.STATE_ENDED && !autoplayEnabled) {
showController()
cancelHideControllerTask()
}
} }
} }
}) })
@ -603,7 +610,8 @@ internal class CustomExoPlayerView(
* Add extra margin to the top bar to not overlap the status bar * Add extra margin to the top bar to not overlap the status bar
*/ */
private fun updateTopBarMargin() { private fun updateTopBarMargin() {
val isFullscreen = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE || val isFullscreen =
resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE ||
playerViewModel?.isFullscreen?.value == true playerViewModel?.isFullscreen?.value == true
binding.topBar.updateLayoutParams<MarginLayoutParams> { binding.topBar.updateLayoutParams<MarginLayoutParams> {
topMargin = (if (isFullscreen) 10 else 0).dpToPx().toInt() topMargin = (if (isFullscreen) 10 else 0).dpToPx().toInt()