simplify config

This commit is contained in:
slymax 2020-04-13 10:00:01 +02:00
parent a104b83571
commit 8e7a8d7811
2 changed files with 5 additions and 2 deletions

View File

@ -8,13 +8,13 @@ This is a template project for Android Studio that allows you to create an andro
If you want to create an app that shows the content of a remote website If you want to create an app that shows the content of a remote website
1. uncomment line **24** in `MainActivity.java` and replace `https://example.com` with your remote source 1. uncomment line **24** in `MainActivity.java` and replace `https://example.com` with your url
```java ```java
mWebView.loadUrl("https://example.com"); mWebView.loadUrl("https://example.com");
``` ```
2. open the `MyWebViewClient.java` file and replace `example.com` on line **13** with your hostname 2. open the `MyWebViewClient.java` file and replace `example.com` on line **15** with your hostname
```java ```java
hostname = "example.com"; hostname = "example.com";

View File

@ -10,7 +10,10 @@ class MyWebViewClient extends WebViewClient {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
String hostname; String hostname;
// YOUR HOSTNAME
hostname = "example.com"; hostname = "example.com";
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith(hostname)) { if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith(hostname)) {
return false; return false;