@ququplay/admob 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.
@@ -26,8 +26,8 @@ import com.google.android.gms.ads.AdSize;
26
26
  import com.google.android.gms.ads.AdView;
27
27
  import com.google.android.gms.ads.LoadAdError;
28
28
  import com.google.android.gms.common.util.BiConsumer;
29
- import android.view.Window;
30
- import androidx.core.view.WindowCompat;
29
+ import androidx.core.view.ViewCompat;
30
+ import androidx.core.view.WindowInsetsCompat;
31
31
 
32
32
  public class BannerExecutor extends Executor {
33
33
 
@@ -105,25 +105,22 @@ public class BannerExecutor extends Executor {
105
105
  break;
106
106
  }
107
107
 
108
- // set Safe Area only for Android 15+
109
- Window window = activitySupplier.get().getWindow();
110
- boolean isEdgeToEdge = !WindowCompat.isDecorFitsSystemWindows(window);
111
- if (isEdgeToEdge) {
112
- View rootView = activitySupplier.get().getWindow().getDecorView();
113
- rootView.setOnApplyWindowInsetsListener((v, insets) -> {
114
- int bottomInset = insets.getSystemWindowInsetBottom();
115
- int topInset = insets.getSystemWindowInsetTop();
116
-
117
- if ("TOP_CENTER".equals(adOptions.position)) {
118
- mAdViewLayoutParams.setMargins(0, topInset, 0, 0);
119
- } else {
120
- mAdViewLayoutParams.setMargins(0, 0, 0, bottomInset);
121
- }
108
+ // Apply window insets for edge-to-edge support
109
+ // Insets will be 0 if not in edge-to-edge mode, so this handles both cases
110
+ View decorView = activitySupplier.get().getWindow().getDecorView();
111
+ ViewCompat.setOnApplyWindowInsetsListener(decorView, (v, insets) -> {
112
+ int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;
113
+ int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
114
+
115
+ if ("TOP_CENTER".equals(adOptions.position)) {
116
+ mAdViewLayoutParams.setMargins(0, topInset, 0, 0);
117
+ } else {
118
+ mAdViewLayoutParams.setMargins(0, 0, 0, bottomInset);
119
+ }
122
120
 
123
- mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
124
- return insets;
125
- });
126
- }
121
+ mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
122
+ return insets;
123
+ });
127
124
 
128
125
  mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
129
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ququplay/admob",
3
- "version": "8.0.3",
3
+ "version": "8.0.4",
4
4
  "description": "A native plugin for AdMob",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",