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, ""); } }