Fix issue where view padding would not properly update on rotation.

This commit is contained in:
Alex Hart
2023-02-16 10:40:31 -04:00
committed by Greyson Parrelli
parent ef11a8d98d
commit 7215ca6a28

View File

@@ -18,12 +18,14 @@ object SystemWindowInsetsSetter {
val insets: Insets? = ViewCompat.getRootWindowInsets(view)?.getInsets(insetType)
if (Build.VERSION.SDK_INT > 29 && insets != null && !insets.isEmpty()) {
view.setPadding(
insets.left,
insets.top,
insets.right,
insets.bottom
)
view.post {
view.setPadding(
insets.left,
insets.top,
insets.right,
insets.bottom
)
}
} else {
val top = if (insetType and WindowInsetsCompat.Type.statusBars() != 0) {
ViewUtil.getStatusBarHeight(view)
@@ -37,12 +39,14 @@ object SystemWindowInsetsSetter {
0
}
view.setPadding(
0,
top,
0,
bottom
)
view.post {
view.setPadding(
0,
top,
0,
bottom
)
}
}
}