@capawesome/capacitor-android-edge-to-edge-support 8.0.3 → 8.0.5
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.
|
@@ -87,10 +87,12 @@ public class EdgeToEdge {
|
|
|
87
87
|
);
|
|
88
88
|
Insets imeInsets = currentInsets.getInsets(WindowInsetsCompat.Type.ime());
|
|
89
89
|
boolean keyboardVisible = currentInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
90
|
+
// Only use IME insets if keyboard is visible AND larger than system bars (handles external keyboard case)
|
|
91
|
+
boolean useImeInsets = keyboardVisible && imeInsets.bottom > systemBarsInsets.bottom;
|
|
90
92
|
|
|
91
93
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
|
92
94
|
|
|
93
|
-
mlp.bottomMargin =
|
|
95
|
+
mlp.bottomMargin = useImeInsets ? imeInsets.bottom : systemBarsInsets.bottom;
|
|
94
96
|
mlp.topMargin = systemBarsInsets.top;
|
|
95
97
|
mlp.leftMargin = systemBarsInsets.left;
|
|
96
98
|
mlp.rightMargin = systemBarsInsets.right;
|
|
@@ -109,11 +111,13 @@ public class EdgeToEdge {
|
|
|
109
111
|
// Retrieve keyboard (IME) insets
|
|
110
112
|
Insets imeInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
|
|
111
113
|
boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
114
|
+
// Only use IME insets if keyboard is visible AND larger than system bars (handles external keyboard case)
|
|
115
|
+
boolean useImeInsets = keyboardVisible && imeInsets.bottom > systemBarsInsets.bottom;
|
|
112
116
|
|
|
113
117
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
|
|
114
118
|
|
|
115
119
|
// Apply the appropriate bottom inset: use keyboard inset if visible, else system bars inset
|
|
116
|
-
mlp.bottomMargin =
|
|
120
|
+
mlp.bottomMargin = useImeInsets ? imeInsets.bottom : systemBarsInsets.bottom;
|
|
117
121
|
|
|
118
122
|
// Set the other margins using system bars insets
|
|
119
123
|
mlp.topMargin = systemBarsInsets.top;
|
|
@@ -140,8 +144,10 @@ public class EdgeToEdge {
|
|
|
140
144
|
mlp.rightMargin = 0;
|
|
141
145
|
mlp.bottomMargin = 0;
|
|
142
146
|
view.setLayoutParams(mlp);
|
|
143
|
-
//
|
|
144
|
-
|
|
147
|
+
// Set a no-op listener that consumes insets without applying them.
|
|
148
|
+
// Using null would allow Android 15's default edge-to-edge handling to take over,
|
|
149
|
+
// which can cause extra padding when re-enabling.
|
|
150
|
+
ViewCompat.setOnApplyWindowInsetsListener(view, (v, windowInsets) -> WindowInsetsCompat.CONSUMED);
|
|
145
151
|
// Remove color overlays
|
|
146
152
|
removeColorOverlays();
|
|
147
153
|
}
|
package/package.json
CHANGED