mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Merge pull request #3656 from Bnyro/master
Fix that the player controls don't hide after scrubbing
This commit is contained in:
commit
36fa4b54d5
@ -201,7 +201,9 @@ internal class CustomExoPlayerView(
|
||||
cancelHideControllerTask()
|
||||
}
|
||||
|
||||
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {}
|
||||
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {
|
||||
enqueueHideControllerTask()
|
||||
}
|
||||
})
|
||||
|
||||
setControllerVisibilityListener(
|
||||
@ -233,6 +235,12 @@ internal class CustomExoPlayerView(
|
||||
)
|
||||
}
|
||||
|
||||
private fun enqueueHideControllerTask() {
|
||||
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
||||
hideController()
|
||||
}
|
||||
}
|
||||
|
||||
private fun cancelHideControllerTask() {
|
||||
handler?.removeCallbacksAndMessages(HIDE_CONTROLLER_TOKEN)
|
||||
}
|
||||
@ -255,9 +263,7 @@ internal class CustomExoPlayerView(
|
||||
// remove the previous callback from the queue to prevent a flashing behavior
|
||||
cancelHideControllerTask()
|
||||
// automatically hide the controller after 2 seconds
|
||||
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
||||
hideController()
|
||||
}
|
||||
enqueueHideControllerTask()
|
||||
super.showController()
|
||||
}
|
||||
|
||||
@ -745,9 +751,7 @@ internal class CustomExoPlayerView(
|
||||
// when a control is clicked, restart the countdown to hide the controller
|
||||
if (isControllerFullyVisible) {
|
||||
cancelHideControllerTask()
|
||||
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
||||
hideController()
|
||||
}
|
||||
enqueueHideControllerTask()
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user