fix the double tap overlay margin

This commit is contained in:
Bnyro 2022-07-29 07:57:16 +02:00
parent f45e1aad24
commit 03a6e190a1
3 changed files with 3 additions and 22 deletions

View File

@ -600,7 +600,6 @@ class PlayerFragment : Fragment() {
}
mainActivity.requestedOrientation = orientation
}
binding.player.setDoubleTapOverlayLayoutParams(90)
Globals.IS_FULL_SCREEN = true
}

View File

@ -54,26 +54,6 @@ internal class CustomExoPlayerView(
setOnClickListener(doubleTouchListener)
}
override fun hideController() {
super.hideController()
setDoubleTapOverlayLayoutParams(0)
}
override fun showController() {
setDoubleTapOverlayLayoutParams(90)
super.showController()
}
// set the top and bottom margin of the double tap overlay
fun setDoubleTapOverlayLayoutParams(margin: Int) {
val dpMargin = resources?.displayMetrics?.density!!.toInt() * margin
val doubleTapOverlay = binding.root.findViewById<DoubleTapOverlay>(R.id.doubleTapOverlay)
val params = doubleTapOverlay.layoutParams as MarginLayoutParams
params.topMargin = dpMargin
params.bottomMargin = dpMargin
doubleTapOverlay.layoutParams = params
}
override fun onTouchEvent(event: MotionEvent): Boolean {
// save the x position of the touch event
xPos = event.x

View File

@ -377,7 +377,9 @@
<com.github.libretube.views.DoubleTapOverlay
android:id="@+id/doubleTapOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_gravity="center"
android:gravity="center"
android:layout_height="wrap_content" />
</com.github.libretube.views.CustomExoPlayerView>