mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
Merge pull request #2777 from Bnyro/master
Only show extra padding when there's a notch
This commit is contained in:
commit
5520a8419a
@ -568,6 +568,9 @@ internal class CustomExoPlayerView(
|
||||
it.layoutParams = params
|
||||
}
|
||||
|
||||
// don't add extra padding if there's no cutout
|
||||
if ((context as? MainActivity)?.windowHelper?.hasCutout() == false) return
|
||||
|
||||
// add a margin to the top and the bottom bar in landscape mode for notches
|
||||
val newMargin = when (newConfig?.orientation) {
|
||||
Configuration.ORIENTATION_LANDSCAPE -> LANDSCAPE_MARGIN_HORIZONTAL
|
||||
|
@ -54,4 +54,12 @@ class WindowHelper(private val activity: BaseActivity) {
|
||||
fun showStatusBar() = activity.apply {
|
||||
WindowInsetsControllerCompat(window, window.decorView).show(WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
|
||||
fun hasCutout(): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
activity.window.decorView.rootWindowInsets.displayCutout != null
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user