@@ -0,0 +1,33 @@
1+package org.reflexfrp.reflexdom;
2+
3+import android.app.Activity;
4+import android.content.Context;
5+import android.view.ViewGroup.LayoutParams;
6+import android.view.Window;
7+import android.webkit.CookieManager;
8+import android.webkit.WebSettings;
9+import android.webkit.WebView;
10+import java.util.concurrent.SynchronousQueue;
11+
12+
13+public class MainWidget {
14+ private static void startMainWidget(Activity a, String url) {
15+ CookieManager.setAcceptFileSchemeCookies(true); //TODO: Can we do this just for our own WebView?
16+
17+ // Remove title and notification bars
18+ a.requestWindowFeature(Window.FEATURE_NO_TITLE);
19+
20+ final WebView wv = new WebView(a);
21+ wv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
22+ a.setContentView(wv);
23+ WebSettings ws = wv.getSettings();
24+ ws.setJavaScriptEnabled(true);
25+ ws.setAllowFileAccessFromFileURLs(true);
26+ ws.setAllowUniversalAccessFromFileURLs(true);
27+ wv.setWebContentsDebuggingEnabled(true);
28+ // allow video to play without user interaction
29+ wv.getSettings().setMediaPlaybackRequiresUserGesture(false);
30+
31+ wv.loadUrl(url);
32+ }
33+}