mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +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()
|
cancelHideControllerTask()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {}
|
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {
|
||||||
|
enqueueHideControllerTask()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setControllerVisibilityListener(
|
setControllerVisibilityListener(
|
||||||
@ -233,6 +235,12 @@ internal class CustomExoPlayerView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun enqueueHideControllerTask() {
|
||||||
|
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
||||||
|
hideController()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun cancelHideControllerTask() {
|
private fun cancelHideControllerTask() {
|
||||||
handler?.removeCallbacksAndMessages(HIDE_CONTROLLER_TOKEN)
|
handler?.removeCallbacksAndMessages(HIDE_CONTROLLER_TOKEN)
|
||||||
}
|
}
|
||||||
@ -255,9 +263,7 @@ internal class CustomExoPlayerView(
|
|||||||
// remove the previous callback from the queue to prevent a flashing behavior
|
// remove the previous callback from the queue to prevent a flashing behavior
|
||||||
cancelHideControllerTask()
|
cancelHideControllerTask()
|
||||||
// automatically hide the controller after 2 seconds
|
// automatically hide the controller after 2 seconds
|
||||||
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
enqueueHideControllerTask()
|
||||||
hideController()
|
|
||||||
}
|
|
||||||
super.showController()
|
super.showController()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,9 +751,7 @@ internal class CustomExoPlayerView(
|
|||||||
// when a control is clicked, restart the countdown to hide the controller
|
// when a control is clicked, restart the countdown to hide the controller
|
||||||
if (isControllerFullyVisible) {
|
if (isControllerFullyVisible) {
|
||||||
cancelHideControllerTask()
|
cancelHideControllerTask()
|
||||||
handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) {
|
enqueueHideControllerTask()
|
||||||
hideController()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(ev)
|
return super.onInterceptTouchEvent(ev)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user