@capawesome/capacitor-android-edge-to-edge-support 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,25 +46,24 @@ public class EdgeToEdge {
|
|
|
46
46
|
parent.setBackgroundColor(this.config.getBackgroundColor());
|
|
47
47
|
// Apply insets to disable the edge-to-edge feature
|
|
48
48
|
ViewCompat.setOnApplyWindowInsetsListener(view, (v, windowInsets) -> {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
// Retrieve system bars insets (for status/navigation bars)
|
|
50
|
+
Insets systemBarsInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
51
|
+
// Retrieve keyboard (IME) insets
|
|
52
|
+
Insets imeInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
|
|
53
|
+
boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
51
54
|
|
|
52
55
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
|
|
53
56
|
|
|
54
|
-
if
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
mlp.bottomMargin = insets.bottom;
|
|
62
|
-
}
|
|
57
|
+
// Apply the appropriate bottom inset: use keyboard inset if visible, else system bars inset
|
|
58
|
+
mlp.bottomMargin = keyboardVisible ? imeInsets.bottom : systemBarsInsets.bottom;
|
|
59
|
+
|
|
60
|
+
// Set the other margins using system bars insets
|
|
61
|
+
mlp.topMargin = systemBarsInsets.top;
|
|
62
|
+
mlp.leftMargin = systemBarsInsets.left;
|
|
63
|
+
mlp.rightMargin = systemBarsInsets.right;
|
|
63
64
|
|
|
64
|
-
mlp.leftMargin = insets.left;
|
|
65
|
-
mlp.rightMargin = insets.right;
|
|
66
|
-
mlp.topMargin = insets.top;
|
|
67
65
|
v.setLayoutParams(mlp);
|
|
66
|
+
|
|
68
67
|
return WindowInsetsCompat.CONSUMED;
|
|
69
68
|
});
|
|
70
69
|
}
|
package/package.json
CHANGED