Skip to content

Commit

Permalink
simplify config
Browse files Browse the repository at this point in the history
  • Loading branch information
slymax committed Apr 13, 2020
1 parent a104b83 commit 8e7a8d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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
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
hostname = "example.com";
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/example/app/MyWebViewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String hostname;

// YOUR HOSTNAME
hostname = "example.com";

Uri uri = Uri.parse(url);
if (url.startsWith("file:") || uri.getHost() != null && uri.getHost().endsWith(hostname)) {
return false;
Expand Down

0 comments on commit 8e7a8d7

Please sign in to comment.