From 846fc9008cc3e142df2ef243ddfefecfac5f2be0 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Tue, 12 Sep 2023 12:12:36 -0300 Subject: [PATCH] Fix issue on lower API devices with insets. Fixes #13156 --- .../thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt b/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt index f310b4a554..c3d86a0d98 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt @@ -16,8 +16,9 @@ object SystemWindowInsetsSetter { fun attach(view: View, lifecycleOwner: LifecycleOwner, @WindowInsetsCompat.Type.InsetsType insetType: Int = WindowInsetsCompat.Type.systemBars()) { val listener = view.doOnEachLayout { val insets: Insets? = ViewCompat.getRootWindowInsets(view)?.getInsets(insetType) + val canTrustInsets = Build.VERSION.SDK_INT > 29 || (WindowInsetsCompat.Type.ime() and insetType == 0) - if (Build.VERSION.SDK_INT > 29 && insets != null && !insets.isEmpty()) { + if (canTrustInsets && insets != null && !insets.isEmpty()) { view.post { view.setPadding( insets.left,