@capawesome/capacitor-android-edge-to-edge-support 8.0.3 → 8.0.4
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;
|
package/package.json
CHANGED