mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Merge pull request #5948 from Bnyro/master
fix: missing horizontal player spacing with display cutout
This commit is contained in:
commit
8fe9d5c6ac
@ -31,9 +31,7 @@ open class BaseActivity : AppCompatActivity() {
|
||||
/**
|
||||
* Whether the phone of the user has a cutout like a notch or not
|
||||
*/
|
||||
val hasCutout by lazy {
|
||||
WindowHelper.hasCutout(window.decorView.rootView)
|
||||
}
|
||||
var hasCutout: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// set the app theme (e.g. Material You)
|
||||
@ -49,6 +47,12 @@ open class BaseActivity : AppCompatActivity() {
|
||||
|
||||
requestOrientationChange()
|
||||
|
||||
// wait for the window decor view to be drawn before detecting display cutouts
|
||||
window.decorView.setOnApplyWindowInsetsListener { view, insets ->
|
||||
hasCutout = WindowHelper.hasCutout(view)
|
||||
insets
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ abstract class CustomExoPlayerView(
|
||||
updateTopBarMargin()
|
||||
|
||||
// don't add extra padding if there's no cutout and no margin set that would need to be undone
|
||||
if (!(context as BaseActivity).hasCutout && binding.topBar.marginStart == LANDSCAPE_MARGIN_HORIZONTAL_NONE) return
|
||||
if (!activity.hasCutout && binding.topBar.marginStart == LANDSCAPE_MARGIN_HORIZONTAL_NONE) return
|
||||
|
||||
// add a margin to the top and the bottom bar in landscape mode for notches
|
||||
val isForcedPortrait = activity.requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||
|
Loading…
Reference in New Issue
Block a user