Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1761f91 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Merge "Apply navigation bars insets to the fullscreen dialog" into tm-qpr-dev...

Merge "Apply navigation bars insets to the fullscreen dialog" into tm-qpr-dev am: f994a9ee am: 280e9854

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19356213



Change-Id: I8484510bc711ab1a795689e1e686541f5c587f0c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 16f71412 280e9854
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -515,11 +515,20 @@ private class AnimatedDialog(
        dialogContentWithBackground.setTransitionVisibility(View.INVISIBLE)

        // Make sure the dialog is visible instantly and does not do any window animation.
        window.attributes.windowAnimations = R.style.Animation_LaunchAnimation
        val attributes = window.attributes
        attributes.windowAnimations = R.style.Animation_LaunchAnimation

        // Ensure that the animation is not clipped by the display cut-out when animating this
        // dialog into an app.
        window.attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
        attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS

        // Ensure that the animation is not clipped by the navigation/task bars when animating this
        // dialog into an app.
        val wasFittingNavigationBars =
            attributes.fitInsetsTypes and WindowInsets.Type.navigationBars() != 0
        attributes.fitInsetsTypes =
            attributes.fitInsetsTypes and WindowInsets.Type.navigationBars().inv()

        window.attributes = window.attributes

        // We apply the insets ourselves to make sure that the paddings are set on the correct
@@ -527,7 +536,13 @@ private class AnimatedDialog(
        window.setDecorFitsSystemWindows(false)
        val viewWithInsets = (dialogContentWithBackground.parent as ViewGroup)
        viewWithInsets.setOnApplyWindowInsetsListener { view, windowInsets ->
            val insets = windowInsets.getInsets(WindowInsets.Type.displayCutout())
            val type = if (wasFittingNavigationBars) {
                WindowInsets.Type.displayCutout() or WindowInsets.Type.navigationBars()
            } else {
                WindowInsets.Type.displayCutout()
            }

            val insets = windowInsets.getInsets(type)
            view.setPadding(insets.left, insets.top, insets.right, insets.bottom)
            WindowInsets.CONSUMED
        }