From 14549fd401a3bcc898cfe3cfa6245031029762b1 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Fri, 11 Nov 2022 12:39:27 -0400 Subject: [PATCH] Fix issue where SystemWindwInsetsSetter didn't respect type on older API levels. --- .../securesms/util/SystemWindowInsetsSetter.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 1d0df27b3..b17d464cd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/SystemWindowInsetsSetter.kt @@ -25,11 +25,23 @@ object SystemWindowInsetsSetter { insets.bottom ) } else { + val top = if (insetType and WindowInsetsCompat.Type.statusBars() != 0) { + ViewUtil.getStatusBarHeight(view) + } else { + 0 + } + + val bottom = if (insetType and WindowInsetsCompat.Type.navigationBars() != 0) { + ViewUtil.getNavigationBarHeight(view) + } else { + 0 + } + view.setPadding( 0, - ViewUtil.getStatusBarHeight(view), + top, 0, - ViewUtil.getNavigationBarHeight(view) + bottom ) } }