@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
- Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
50
- Boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
55
- if (keyboardVisible) {
56
- mlp.bottomMargin = 0;
57
- } else {
58
- mlp.bottomMargin = insets.bottom;
59
- }
60
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-android-edge-to-edge-support",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "Capacitor plugin to support edge-to-edge display on Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",