From dd910f725698b202b7ef6f8bbab06244bd079e1f Mon Sep 17 00:00:00 2001
From: Michael W <baddaemon87@gmail.com>
Date: Sat, 10 Apr 2021 17:29:00 +0200
Subject: [PATCH] EasterEgg: Fix some warnings

* Replace deprecated methods with the ones the android doc recommends
  as a replacement

Change-Id: I1be5ba74da6f9a8e68bed4a0478675f90c9c28c6
Signed-off-by: Joey Huab <joey@evolution-x.org>
---
 .../src/com/android/egg/paint/ToolbarView.kt        | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt b/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt
index 20527afd9652..b1414f9d6689 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
         }
-- 
GitLab