simplify config

This commit is contained in:
slymax
2020-03-29 18:26:24 +02:00
parent 8c64844ced
commit 717d7e8825
2 changed files with 6 additions and 4 deletions

View File

@ -9,8 +9,10 @@ class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String hostname;
hostname = "example.com";
Uri uri = Uri.parse(url);
if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith("example.com")) {
if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith(hostname)) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));