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

main
Alex Hart 2023-02-16 10:40:31 -04:00 zatwierdzone przez Greyson Parrelli
rodzic ef11a8d98d
commit 7215ca6a28
1 zmienionych plików z 16 dodań i 12 usunięć

Wyświetl plik

@ -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
)
}
}
}