@capgo/inappbrowser 7.16.0 → 7.16.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.
@@ -1084,6 +1084,40 @@ public class WebViewDialog extends Dialog {
1084
1084
  params.topMargin = statusBarHeight;
1085
1085
  appBarLayout.setLayoutParams(params);
1086
1086
  appBarLayout.setBackgroundColor(finalBgColor);
1087
+ View contentBrowserLayout = findViewById(R.id.content_browser_layout);
1088
+ View parentContainer = findViewById(android.R.id.content);
1089
+ if (contentBrowserLayout == null || parentContainer == null) {
1090
+ Log.w(
1091
+ "InAppBrowser",
1092
+ "Required views not found for height calculation"
1093
+ );
1094
+ return;
1095
+ }
1096
+
1097
+ ViewGroup.LayoutParams layoutParams =
1098
+ contentBrowserLayout.getLayoutParams();
1099
+ if (!(layoutParams instanceof ViewGroup.MarginLayoutParams)) {
1100
+ Log.w(
1101
+ "InAppBrowser",
1102
+ "Content browser layout does not support margins"
1103
+ );
1104
+ return;
1105
+ }
1106
+ ViewGroup.MarginLayoutParams mlpContentBrowserLayout =
1107
+ (ViewGroup.MarginLayoutParams) layoutParams;
1108
+
1109
+ int parentHeight = parentContainer.getHeight();
1110
+ int appBarHeight = appBarLayout.getHeight(); // can be 0 if not visible with the toolbar type BLANK
1111
+
1112
+ if (parentHeight <= 0) {
1113
+ Log.w("InAppBrowser", "Parent dimensions not yet available");
1114
+ return;
1115
+ }
1116
+
1117
+ // Recompute the height of the content browser to be able to set margin bottom as we want to
1118
+ mlpContentBrowserLayout.height =
1119
+ parentHeight - (statusBarHeight + appBarHeight);
1120
+ contentBrowserLayout.setLayoutParams(mlpContentBrowserLayout);
1087
1121
  });
1088
1122
  }
1089
1123
  }
@@ -1100,48 +1134,17 @@ public class WebViewDialog extends Dialog {
1100
1134
  ViewGroup.MarginLayoutParams mlp =
1101
1135
  (ViewGroup.MarginLayoutParams) v.getLayoutParams();
1102
1136
 
1103
- // Apply margins based on Android version
1104
- if (isAndroid15Plus) {
1105
- // Android 15+ specific handling
1106
- if (keyboardVisible) {
1107
- mlp.bottomMargin = 0;
1108
- } else {
1109
- mlp.bottomMargin = insets.bottom;
1110
- }
1111
- // On Android 15+, don't add top margin as it's handled by AppBarLayout
1112
- mlp.topMargin = 0;
1113
- } else {
1114
- // For all other Android versions, ensure bottom margin respects navigation bar
1115
- mlp.topMargin = 0; // Top is handled by toolbar
1116
- if (keyboardVisible) {
1117
- mlp.bottomMargin = 0;
1118
- } else {
1119
- mlp.bottomMargin = insets.bottom;
1120
- }
1137
+ // // Apply margins based on Android version
1138
+ if (_options.getEnabledSafeMargin()) {
1139
+ mlp.bottomMargin = insets.bottom;
1121
1140
  }
1122
1141
 
1123
1142
  // These stay the same for all Android versions
1143
+ mlp.topMargin = 0;
1124
1144
  mlp.leftMargin = insets.left;
1125
1145
  mlp.rightMargin = insets.right;
1126
1146
  v.setLayoutParams(mlp);
1127
1147
 
1128
- // Apply safe area padding to parent container if enabled
1129
- if (_options.getEnabledSafeMargin()) {
1130
- View parentContainer = findViewById(android.R.id.content);
1131
- if (parentContainer != null) {
1132
- Log.d(
1133
- "InAppBrowser",
1134
- "Applying bottom safe area padding: " + insets.bottom
1135
- );
1136
- parentContainer.setPadding(
1137
- parentContainer.getPaddingLeft(),
1138
- parentContainer.getPaddingTop(),
1139
- parentContainer.getPaddingRight(),
1140
- insets.bottom
1141
- );
1142
- }
1143
- }
1144
-
1145
1148
  return WindowInsetsCompat.CONSUMED;
1146
1149
  });
1147
1150
 
@@ -1,9 +1,10 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
+ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  xmlns:app="http://schemas.android.com/apk/res-auto"
4
4
  xmlns:tools="http://schemas.android.com/tools"
5
5
  android:layout_width="match_parent"
6
6
  android:layout_height="match_parent"
7
+ android:id="@+id/content_browser_layout"
7
8
  app:layout_behavior="@string/appbar_scrolling_view_behavior"
8
9
  tools:context="com.cap.browser.plugin.WebViewActivity"
9
10
  tools:showIn="@layout/activity_browser">
@@ -11,6 +12,6 @@
11
12
  <WebView
12
13
  android:id="@+id/browser_view"
13
14
  android:layout_width="match_parent"
14
- android:layout_height="match_parent"/>
15
+ android:layout_height="wrap_content"/>
15
16
 
16
- </androidx.constraintlayout.widget.ConstraintLayout>
17
+ </RelativeLayout>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "7.16.0",
3
+ "version": "7.16.1",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",