1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
package pw.cloudef.rpg;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.view.KeyEvent;
import android.util.Log;
public class Nodeweb extends Base {
private WebView web;
protected String[] getLibraries() {
return new String[] {
"physfs-serve"
};
}
protected String[] getArguments() {
return new String[] {
"-p", "1337",
"-i", "localhost",
"game.zip",
"mv-overlay.zip",
};
}
protected int mainLayout() {
return R.layout.webview;
}
protected boolean hideFully() {
return true;
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
return web.dispatchKeyEvent(event);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
web = (WebView)findViewById(R.id.web);
web.loadUrl("http://127.0.0.1:1337?webgl");
web.getSettings().setJavaScriptEnabled(true);
web.setWebContentsDebuggingEnabled(true);
web.getSettings().setDomStorageEnabled(true);
web.getSettings().setDatabaseEnabled(true);
web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
if (android.os.Build.VERSION.SDK_INT > 16) web.getSettings().setMediaPlaybackRequiresUserGesture(false);
web.setWebViewClient(new WebViewClient(){
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.v("nodeweb", "error: " + errorCode);
view.loadUrl(failingUrl);
};
});
setWindowStyle(true);
setOrientation(0, 0, true, "");
}
}
|