mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
@@ -16,8 +16,9 @@ object SystemWindowInsetsSetter {
|
|||||||
fun attach(view: View, lifecycleOwner: LifecycleOwner, @WindowInsetsCompat.Type.InsetsType insetType: Int = WindowInsetsCompat.Type.systemBars()) {
|
fun attach(view: View, lifecycleOwner: LifecycleOwner, @WindowInsetsCompat.Type.InsetsType insetType: Int = WindowInsetsCompat.Type.systemBars()) {
|
||||||
val listener = view.doOnEachLayout {
|
val listener = view.doOnEachLayout {
|
||||||
val insets: Insets? = ViewCompat.getRootWindowInsets(view)?.getInsets(insetType)
|
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.post {
|
||||||
view.setPadding(
|
view.setPadding(
|
||||||
insets.left,
|
insets.left,
|
||||||
|
|||||||
Reference in New Issue
Block a user