Skip to content

Commit

Permalink
Fixing issue where footer overlaps webview content on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
hvaughan3 committed Sep 5, 2018
1 parent bf69393 commit 800ba9f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
toolbar.addView(close);

// Footer
int footerSize = this.dpToPixels(44);

RelativeLayout footer = new RelativeLayout(cordova.getActivity());
int _footerColor;
if(footerColor != ""){
Expand All @@ -820,7 +822,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
_footerColor = android.graphics.Color.LTGRAY;
}
footer.setBackgroundColor(_footerColor);
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44));
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, footerSize);
footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
footer.setLayoutParams(footerLayout);
if (closeButtonCaption != "") footer.setPadding(this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8));
Expand All @@ -833,7 +835,15 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {

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

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

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

inAppWebView.setLayoutParams(webViewLayoutParams);
inAppWebView.setId(Integer.valueOf(6));
// File Chooser Implemented ChromeClient
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
Expand Down

0 comments on commit 800ba9f

Please sign in to comment.