Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebViewDialog just reacts strange. #22

Closed
Rainer-Lang opened this issue Jan 10, 2017 · 10 comments
Closed

WebViewDialog just reacts strange. #22

Rainer-Lang opened this issue Jan 10, 2017 · 10 comments

Comments

@Rainer-Lang
Copy link
Contributor

It's still sideways scrollable.
If I use a WebView in AboutLibraries - all is fine, nothin to scroll, all visible, even with margin around the content. I have to investigate this issue tomorrow.

@daniel-stoneuk
Copy link
Owner

daniel-stoneuk commented Jan 10, 2017

Are you sure? Did you set the allowZooming parameter to false?

@Rainer-Lang
Copy link
Contributor Author

Set to false. Then the whole page is visible - but a bit small.... ;)

@daniel-stoneuk
Copy link
Owner

Wait, so when it's set to false nothing will scroll which is what you want? and then you want to also be able to zoom in?

@Rainer-Lang
Copy link
Contributor Author

In AboutLibs there is a margin/padding around the content - and the WebView is only vertical scrollable.
You could just test it.

@Rainer-Lang
Copy link
Contributor Author

I don't need to zoom-in.

@daniel-stoneuk
Copy link
Owner

I'm really sorry I don't really have an idea of what you're looking for. Maybe a screenshot will help?

@Rainer-Lang
Copy link
Contributor Author

I'll send ins tomorrow. Nö problem. ☺️

@Rainer-Lang
Copy link
Contributor Author

SwiftKey is sometimes annoying....

@daniel-stoneuk
Copy link
Owner

Thanks, I might have a little break from the computer now!

@Rainer-Lang
Copy link
Contributor Author

In AboutLibs I define on my own what should happen. Here is the code:

MaterialDialog.Builder alert = new MaterialDialog.Builder(ctx);

WebView webView = new WebView(ctx);
webView.getSettings().setJavaScriptEnabled(true);

webView.loadUrl(uri);

webView.setWebViewClient(new WebViewClient() {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
  }
  @Override
  public void onPageFinished(WebView view, String url) {
    view.loadUrl("javascript:document.body.style.margin=\"8%\"; void 0");
  }
});

alert.customView(webView, true)
    .negativeText(R.string.close)
    .onNegative((dialog, which) -> dialog.dismiss())
    .show();

I'm using Material-Dialogs. I'm sure you don't like to include this lib.
So I use the "normal" item and set my own ClickListener.

For me the issue is finished. Thanks for your effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants