mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
Apply top bar for vertical fullscreen too
This commit is contained in:
parent
e4cbb2b90c
commit
089e72b0c7
@ -228,6 +228,7 @@ internal class CustomExoPlayerView(
|
||||
if (it.isFullscreen.value == true) {
|
||||
windowHelper?.setFullscreen()
|
||||
}
|
||||
updateTopBarMargin()
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,15 +592,7 @@ internal class CustomExoPlayerView(
|
||||
it.layoutParams = params
|
||||
}
|
||||
|
||||
// add padding to the top bar to not overlap the status bar
|
||||
binding.topBar.let {
|
||||
setPadding(
|
||||
it.paddingLeft,
|
||||
(if (newConfig?.orientation == Configuration.ORIENTATION_LANDSCAPE) 25 else 5).toPixel().toInt(),
|
||||
it.paddingRight,
|
||||
it.paddingBottom
|
||||
)
|
||||
}
|
||||
updateTopBarMargin()
|
||||
|
||||
// don't add extra padding if there's no cutout
|
||||
if ((context as? MainActivity)?.windowHelper?.hasCutout() == false) return
|
||||
@ -632,6 +625,19 @@ internal class CustomExoPlayerView(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extra margin to the top bar to not overlap the status bar
|
||||
*/
|
||||
private fun updateTopBarMargin() {
|
||||
val isFullscreen = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE ||
|
||||
playerViewModel?.isFullscreen?.value == true
|
||||
binding.topBar.let {
|
||||
it.layoutParams = (it.layoutParams as MarginLayoutParams).apply {
|
||||
topMargin = (if (isFullscreen) 25 else 5).toPixel().toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSingleTap() {
|
||||
toggleController()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user