mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
improve when the buttons show
This commit is contained in:
parent
506b97536a
commit
a705b29b95
@ -984,6 +984,7 @@ class PlayerFragment : Fragment() {
|
|||||||
private fun enableDoubleTapToSeek() {
|
private fun enableDoubleTapToSeek() {
|
||||||
val seekIncrement =
|
val seekIncrement =
|
||||||
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
||||||
|
|
||||||
val hideDoubleTapOverlayDelay = 700L
|
val hideDoubleTapOverlayDelay = 700L
|
||||||
|
|
||||||
// enable rewind button
|
// enable rewind button
|
||||||
@ -991,11 +992,14 @@ class PlayerFragment : Fragment() {
|
|||||||
context,
|
context,
|
||||||
object : SimpleOnGestureListener() {
|
object : SimpleOnGestureListener() {
|
||||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||||
binding.rewindBTN.visibility = View.VISIBLE
|
|
||||||
exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
|
exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
|
||||||
binding.rewindBTN.visibility = View.INVISIBLE
|
// show the rewind button
|
||||||
}, hideDoubleTapOverlayDelay)
|
binding.rewindBTN.apply {
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
removeCallbacks(hideRewindButtonRunnable)
|
||||||
|
postDelayed(hideRewindButtonRunnable, hideDoubleTapOverlayDelay)
|
||||||
|
}
|
||||||
return super.onDoubleTap(e)
|
return super.onDoubleTap(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,12 +1021,15 @@ class PlayerFragment : Fragment() {
|
|||||||
context,
|
context,
|
||||||
object : SimpleOnGestureListener() {
|
object : SimpleOnGestureListener() {
|
||||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||||
binding.forwardBTN.visibility = View.VISIBLE
|
|
||||||
exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
|
exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
|
||||||
binding.forwardBTN.visibility = View.INVISIBLE
|
// show the forward button
|
||||||
}, hideDoubleTapOverlayDelay)
|
binding.forwardBTN.apply {
|
||||||
return super.onSingleTapConfirmed(e)
|
visibility = View.VISIBLE
|
||||||
|
removeCallbacks(hideForwardButtonRunnable)
|
||||||
|
postDelayed(hideForwardButtonRunnable, hideDoubleTapOverlayDelay)
|
||||||
|
}
|
||||||
|
return super.onDoubleTap(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
||||||
@ -1039,6 +1046,9 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val hideForwardButtonRunnable = Runnable { binding.forwardBTN.visibility = View.GONE }
|
||||||
|
private val hideRewindButtonRunnable = Runnable { binding.rewindBTN.visibility = View.GONE }
|
||||||
|
|
||||||
private fun disableDoubleTapToSeek() {
|
private fun disableDoubleTapToSeek() {
|
||||||
// disable fast forward and rewind by double tapping
|
// disable fast forward and rewind by double tapping
|
||||||
binding.forwardFL.visibility = View.GONE
|
binding.forwardFL.visibility = View.GONE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user