Derp
parent
1571f808e3
commit
b02d7ee3a4
BIN
bin/classes.dex
BIN
bin/classes.dex
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -34,6 +34,7 @@ public final class R {
|
||||||
}
|
}
|
||||||
public static final class string {
|
public static final class string {
|
||||||
public static final int app_name=0x7f050000;
|
public static final int app_name=0x7f050000;
|
||||||
|
public static final int injectJS=0x7f050001;
|
||||||
}
|
}
|
||||||
public static final class style {
|
public static final class style {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">Simtech <thunder></string>
|
<string name="app_name">Simtech <thunder></string>
|
||||||
|
<string name="injectJS">javascript:console.log("Hello!");</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.thunder.simtech;
|
package com.thunder.simtech;
|
||||||
|
|
||||||
|
import java.io.Console;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -20,6 +22,11 @@ public class MainActivity extends Activity {
|
||||||
WebSettings webSettings = webView.getSettings();
|
WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
String javascript = getString(R.string.injectJS);
|
||||||
|
Log.d(null, javascript);
|
||||||
|
view.loadUrl(javascript);
|
||||||
|
}
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url){
|
public boolean shouldOverrideUrlLoading(WebView view, String url){
|
||||||
view.loadUrl(url);
|
view.loadUrl(url);
|
||||||
EditText editText = (EditText) findViewById(R.id.editText);
|
EditText editText = (EditText) findViewById(R.id.editText);
|
||||||
|
@ -43,7 +50,7 @@ public class MainActivity extends Activity {
|
||||||
if (editText.getText()==null)return;
|
if (editText.getText()==null)return;
|
||||||
String url = editText.getText().toString();
|
String url = editText.getText().toString();
|
||||||
|
|
||||||
if (!url.contains("http://"))url = "http://"+url;
|
if (!url.contains("http://") && !url.contains("javascript:"))url = "http://"+url;
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
Log.i("AndroidDemo", "Visiting: "+url);
|
Log.i("AndroidDemo", "Visiting: "+url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue