diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 2770997f1..19eb502b8 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -488,6 +488,7 @@ internal class CustomExoPlayerView( override fun onConfigurationChanged(newConfig: Configuration?) { super.onConfigurationChanged(newConfig) + // add a larger bottom margin to the time bar in landscape mode val offset = when (newConfig?.orientation) { Configuration.ORIENTATION_LANDSCAPE -> 20.toPixel() else -> 10.toPixel() @@ -498,6 +499,22 @@ internal class CustomExoPlayerView( params.bottomMargin = offset.toInt() it.layoutParams = params } + + // add a margin to the top and the bottom bar in landscape mode for notches + val newMargin = if ( + newConfig?.orientation == Configuration.ORIENTATION_LANDSCAPE + ) { + LANDSCAPE_MARGIN_HORIZONTAL + } else { + 0 + } + + listOf(binding.exoTopBar, binding.exoBottomBar).forEach { + val params = it.layoutParams as MarginLayoutParams + params.marginStart = newMargin + params.marginEnd = newMargin + it.layoutParams = params + } } override fun onSingleTap() { @@ -576,5 +593,6 @@ internal class CustomExoPlayerView( companion object { private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f + private val LANDSCAPE_MARGIN_HORIZONTAL = (30).toPixel().toInt() } } diff --git a/app/src/main/res/layout/exo_styled_player_control_view.xml b/app/src/main/res/layout/exo_styled_player_control_view.xml index ca1982210..67a19a84b 100644 --- a/app/src/main/res/layout/exo_styled_player_control_view.xml +++ b/app/src/main/res/layout/exo_styled_player_control_view.xml @@ -16,9 +16,8 @@ android:layout_gravity="top" android:animateLayoutChanges="true" android:orientation="vertical" - android:paddingStart="5dp" - android:paddingTop="5dp" - android:paddingEnd="10dp"> + android:paddingHorizontal="5dp" + android:paddingTop="5dp" >