minor fixes

This commit is contained in:
slymax 2019-09-23 01:38:12 +02:00
parent 66d545e734
commit 1582de593e
2 changed files with 2 additions and 10 deletions

View File

@ -16,25 +16,19 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = findViewById(R.id.activity_main_webview);
// Force links and redirects to open in the WebView instead of in a browser
mWebView.setWebViewClient(new WebViewClient());
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
// REMOTE RESOURCE
// mWebView.loadUrl("http://example.com");
// mWebView.loadUrl("https://example.com");
// mWebView.setWebViewClient(new MyWebViewClient());
// LOCAL RESOURCE
// mWebView.loadUrl("file:///android_asset/index.html");
}
// Prevent the back-button from closing the app
@Override
public void onBackPressed() {
if(mWebView.canGoBack()) {
@ -43,5 +37,4 @@ public class MainActivity extends Activity {
super.onBackPressed();
}
}
}
}

View File

@ -7,7 +7,6 @@ import android.webkit.WebViewClient;
class MyWebViewClient extends WebViewClient {
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Uri uri = Uri.parse(url);