Skip to content

Commit

Permalink
Fixing WebView sizing issues when displaying the footer (too much spa…
Browse files Browse the repository at this point in the history
…ce given to footer)
  • Loading branch information
Hines Vaughan committed Sep 8, 2020
1 parent 79a3ec5 commit a9c27cd
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -964,11 +964,12 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, footerSize);
footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
footer.setLayoutParams(footerLayout);

if (closeButtonCaption != "") {
int footerPadding = this.dpToPixels(8);
footer.setPadding(footerPadding, footerPadding, footerPadding, footerPadding);
footerSize = footerSize + (footerPadding * 2); // Double the padding height since it is on top and bottom
}

footer.setHorizontalGravity(Gravity.LEFT);
footer.setVerticalGravity(Gravity.BOTTOM);

Expand All @@ -981,19 +982,19 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
// webViewHeight = webViewHeight - this.dpToPixels(44);
// }

if (showFooter) {
webViewHeight = webViewHeight - footerSize;
}
// if (showFooter) {
// webViewHeight = webViewHeight - footerSize;
// }

// WebView
inAppWebView = new WebView(cordova.getActivity());
// inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

LinearLayout.LayoutParams webViewLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, webViewHeight);

// if (showFooter) {
// webViewLayoutParams.setMargins(0, 0, 0, footerSize); // Adding margin the same size as the footer
// }
if (showFooter) {
webViewLayoutParams.setMargins(0, 0, 0, footerSize); // Adding margin the same size as the footer
}

inAppWebView.setLayoutParams(webViewLayoutParams);
inAppWebView.setId(Integer.valueOf(6));
Expand Down

0 comments on commit a9c27cd

Please sign in to comment.