@capawesome/capacitor-android-edge-to-edge-support 8.0.7 → 8.0.8

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.
@@ -1,7 +1,6 @@
1
1
  package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
2
2
 
3
3
  import android.graphics.Color;
4
- import android.os.Build;
5
4
  import android.view.Gravity;
6
5
  import android.view.View;
7
6
  import android.view.ViewGroup;
@@ -99,9 +98,14 @@ public class EdgeToEdge {
99
98
 
100
99
  ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
101
100
  mlp.bottomMargin = bottomMargin;
102
- // Only apply top margin on Android 15+ where edge-to-edge is enforced.
103
- // On older versions, the system already positions content below the status bar.
104
- mlp.topMargin = Build.VERSION.SDK_INT >= 35 ? systemBarsInsets.top : 0;
101
+ // Apply top margin when edge-to-edge is active. On Android 15+ it is always enforced.
102
+ // On older versions, use the system content view's top padding only as a heuristic that
103
+ // the top inset may already be handled elsewhere (for example by decor fitting or another
104
+ // insets/padding adjustment), rather than as a guaranteed signal of decorFitsSystemWindows.
105
+ View contentView = plugin.getActivity().findViewById(android.R.id.content);
106
+ boolean topInsetLikelyHandledBySystem =
107
+ contentView != null && contentView.getPaddingTop() >= systemBarsInsets.top && systemBarsInsets.top > 0;
108
+ mlp.topMargin = topInsetLikelyHandledBySystem ? 0 : systemBarsInsets.top;
105
109
  mlp.leftMargin = systemBarsInsets.left;
106
110
  mlp.rightMargin = systemBarsInsets.right;
107
111
  view.setLayoutParams(mlp);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-android-edge-to-edge-support",
3
- "version": "8.0.7",
3
+ "version": "8.0.8",
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",