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 36e1aad9c..b592b9574 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 @@ -202,13 +202,10 @@ internal class CustomExoPlayerView( } override fun hideController() { - if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { - // hide all the navigation bars that potentially could have been reopened manually by the user - (context as? MainActivity)?.windowHelper?.setFullscreen() - } // remove the callback to hide the controller handler.removeCallbacks(hideControllerRunnable) super.hideController() + (context as? MainActivity)?.windowHelper?.hideStatusBar() } override fun showController() { @@ -578,10 +575,10 @@ internal class CustomExoPlayerView( } listOf(binding.topBar, binding.bottomBar).forEach { - val params = it.layoutParams as MarginLayoutParams - params.marginStart = newMargin - params.marginEnd = newMargin - it.layoutParams = params + it.layoutParams = (it.layoutParams as MarginLayoutParams).apply { + marginStart = newMargin + marginEnd = newMargin + } } } @@ -676,6 +673,6 @@ internal class CustomExoPlayerView( companion object { private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f private const val ANIMATION_DURATION = 100L - private val LANDSCAPE_MARGIN_HORIZONTAL = (30).toPixel().toInt() + private val LANDSCAPE_MARGIN_HORIZONTAL = (20).toPixel().toInt() } } diff --git a/app/src/main/java/com/github/libretube/util/WindowHelper.kt b/app/src/main/java/com/github/libretube/util/WindowHelper.kt index e75c6855d..7f669d25f 100644 --- a/app/src/main/java/com/github/libretube/util/WindowHelper.kt +++ b/app/src/main/java/com/github/libretube/util/WindowHelper.kt @@ -46,4 +46,12 @@ class WindowHelper(private val activity: BaseActivity) { window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) } + + fun hideStatusBar() = activity.apply { + WindowInsetsControllerCompat(window, window.decorView).hide(WindowInsetsCompat.Type.statusBars()) + } + + fun showStatusBar() = activity.apply { + WindowInsetsControllerCompat(window, window.decorView).show(WindowInsetsCompat.Type.statusBars()) + } } 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 a4fb1cced..71671e086 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 @@ -17,7 +17,7 @@ android:animateLayoutChanges="true" android:orientation="vertical" android:paddingHorizontal="5dp" - android:paddingTop="5dp" > + android:paddingTop="25dp" >