diff --git a/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt b/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt index 20527afd9652f9b248c2660b04b34580a9b9b2ac..b1414f9d668909e7fa1651424d645f41236af488 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt +++ b/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt @@ -51,12 +51,15 @@ class ToolbarView : FrameLayout { override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets { var lp = layoutParams as FrameLayout.LayoutParams? if (lp != null && insets != null) { - if (insets.hasStableInsets()) { - lp.topMargin = insets.stableInsetTop - lp.bottomMargin = insets.stableInsetBottom + var stableInsets = insets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars()); + if (stableInsets.top != 0 || stableInsets.bottom != 0 || stableInsets.left != 0 || + stableInsets.right != 0) { + lp.topMargin = stableInsets.top + lp.bottomMargin = stableInsets.bottom } else { - lp.topMargin = insets.systemWindowInsetTop - lp.bottomMargin = insets.systemWindowInsetBottom + var systemInsets = insets.getInsets(WindowInsets.Type.systemBars()); + lp.topMargin = systemInsets.top + lp.bottomMargin = systemInsets.bottom } layoutParams = lp }