Enable WebView prompts and localStorage and stuff.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4216 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
10bfa65a4e
commit
52ae19220c
@ -1,12 +1,16 @@
|
|||||||
package com.unprompted.tildefriends;
|
package com.unprompted.tildefriends;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.webkit.JsResult;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import java.lang.Process;
|
import java.lang.Process;
|
||||||
@ -72,8 +76,37 @@ public class MainActivity extends Activity {
|
|||||||
} catch (java.lang.InterruptedException e) {
|
} catch (java.lang.InterruptedException e) {
|
||||||
}
|
}
|
||||||
web.getSettings().setJavaScriptEnabled(true);
|
web.getSettings().setJavaScriptEnabled(true);
|
||||||
|
web.getSettings().setDatabaseEnabled(true);
|
||||||
|
web.getSettings().setDomStorageEnabled(true);
|
||||||
|
|
||||||
|
web.setWebChromeClient(new WebChromeClient() {
|
||||||
|
@Override
|
||||||
|
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
|
||||||
|
new AlertDialog.Builder(view.getContext())
|
||||||
|
.setTitle("Tilde Friends")
|
||||||
|
.setMessage(message)
|
||||||
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
result.confirm();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
result.cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.create()
|
||||||
|
.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
web.setWebViewClient(new WebViewClient() {
|
web.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url)
|
public boolean shouldOverrideUrlLoading(WebView view, String url)
|
||||||
{
|
{
|
||||||
if (url != null && url.startsWith("http://127.0.0.1:12345/")) {
|
if (url != null && url.startsWith("http://127.0.0.1:12345/")) {
|
||||||
@ -85,6 +118,6 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
web.loadUrl("http://127.0.0.1:12345/~core/apps/");
|
web.loadUrl("http://127.0.0.1:12345/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user