mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
Merge pull request #2776 from Bnyro/master
Keep space for the status bar in player
This commit is contained in:
commit
579e8f167e
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:paddingTop="5dp" >
|
||||
android:paddingTop="25dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user