public getSettings ( ) : global::android.webkit.WebSettings | ||
Résultat | global::android.webkit.WebSettings |
public override void createAndAttachView(int id, FrameLayout frame) { // http://stackoverflow.com/questions/2761577/android-start-an-intent-into-a-framelayout // http://gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity#comment-37 // http://stackoverflow.com/questions/4882776/start-another-activity-inside-the-framelayout-of-tabactivity // Caused by: java.lang.RuntimeException: You must attach your view to the given frame in createAndAttachView() //at wei.mark.standout.ui.Window.<init>(Window.java:154) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) var ll = new LinearLayout( frame.getContext() ); //ll.setAlpha(0.8f); ll.setOrientation(LinearLayout.VERTICAL); #region lltab var lltab = new LinearLayout( frame.getContext() ); lltab.AttachTo(ll); var captionpadding = new TextView(frame.getContext()); captionpadding.setText(" "); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android captionpadding.setShadowLayer(1, 0, 0, Color.WHITE); captionpadding.setTextColor(Color.WHITE); captionpadding.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); captionpadding.AttachTo(lltab); var caption = new TextView(frame.getContext()); caption.setText("XWidgetsWindow"); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android caption.setShadowLayer(1, 0, 0, Color.WHITE); caption.setTextColor(Color.WHITE); caption.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); caption.AttachTo(lltab); var close = new TextView(frame.getContext()); close.setText(" x "); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android close.setShadowLayer(1, 0, 0, Color.RED); close.setTextColor(Color.RED); close.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); close.AttachTo(lltab); close.setClickable(true); close.AtClick( delegate { this.close(id); } ); #endregion //wei.mark.standout.WindowCache r; #region WebView var webview = new WebView(frame.getContext()); //webview.setAlpha(0.8f); //frame.startAnimation(new AlphaAnimation(1f, 0.7f)); // java.lang.NoSuchMethodError: android.webkit.WebView.setAlpha //at PopupWebView.Activities.XWidgetsWindow.createAndAttachView(XWidgetsWindow.java:83) //at wei.mark.standout.ui.Window.<init>(Window.java:142) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1026) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2043) //at android.app.ActivityThread.access$2800(ActivityThread.java:117) //at android.app.ActivityThread$H.handleMessage(ActivityThread.java:998) //at android.os.Handler.dispatchMessage(Handler.java:99) //at android.os.Looper.loop(Looper.java:123) //at android.app.ActivityThread.main(ActivityThread.java:3687) //at java.lang.reflect.Method.invokeNative(Native Method) //at java.lang.reflect.Method.invoke(Method.java:507) //at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) //at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) //at dalvik.system.NativeStart.main(Native Method) //getWindow().setFlags( // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED, // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED); //setContentView(webview); //webview.getSettings().setSupportZoom(true); //webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); //webview.getSettings().setBuiltInZoomControls(true); //webview.setInitialScale(1); webview.setWebViewClient(new MyWebViewClient { //__this = this }); webview.setWebChromeClient( new MyWebChromeClient { yield_title = // implicit version does not work? value => { caption.setText(value); PersistentNotifications .Where(k => k.id == id) .WithEach( n => { n.contentText = value; n.Notification.setLatestEventInfo( n.context, n.contentTitle, n.contentText, n.contentIntent ); n.update(); } ); } } ); //webview.getSettings().setSupportZoom(true); //webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); //var uri = "http://cubiq.org/dropbox/3dcity/"; var uri = "http://abstractatech.com"; webview.loadUrl(uri); #endregion // http://forum.xda-developers.com/showthread.php?t=1688531 var rr = new RelativeLayout(frame.getContext()); rr.setBackgroundColor(Color.argb(0x1F, 255, 255, 255)); webview.AttachTo(rr); var resizer = new Button(frame.getContext()); resizer.setText(".:"); //resizer.setAlpha(0.4f); resizer.setWidth(96); resizer.setHeight(96); resizer.setBackgroundColor(Color.argb(0x7F, 255, 255, 255)); // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code resizer.AttachTo(rr); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT ); //400, 250, p.setMargins(400 - 64, 250 - 64 - 32, 0, 0); resizer.setLayoutParams(p); resizer.setOnTouchListener( new __OnTouchListener { yield = (view, e) => { var ww = getWindow(id); // handle dragging to move var consumed = this.onTouchHandleResize(id, ww, view, e ); { p.setMargins(ww.getWidth() - 64 + 10, ww.getHeight() - 64 - 20, 0, 0); resizer.setLayoutParams(p); } return consumed; } } ); rr.AttachTo(ll); ll.AttachTo(frame); { //Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to wei.mark.standout.StandOutWindow$StandOutLayoutParams //at wei.mark.example.XWidgetsWindow.createAndAttachView(XWidgetsWindow.java:101) //at wei.mark.standout.ui.Window.<init>(Window.java:150) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) //p.setMargins(ww.getWidth() - 64, ww.getHeight() - 64 - 32, 0, 0); //resizer.setLayoutParams(p); } }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); height = getWindowManager().getDefaultDisplay().getHeight(); width = getWindowManager().getDefaultDisplay().getWidth(); this.ToFullscreen(); if (width > height) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // http://stackoverflow.com/questions/8469112/hide-ics-back-home-task-switcher-buttons // http://developer.android.com/reference/android/view/View.OnSystemUiVisibilityChangeListener.html // http://stackoverflow.com/questions/9131790/android-lights-out-mode-not-working // http://baroqueworksdev.blogspot.com/2012/02/request-that-visibility-of.html } var r = new System.Random(); var port = r.Next(1024, 32000); uri = "http://" + getLocalIpAddress(); uri += ":"; uri += ((object)(port)).ToString(); this.setTitle(uri); ServerSocket serversocket = null; bool isRunning = true; #region openFileFromAssets Func<string, InputStream> openFileFromAssets = (string spath) => { InputStream value = null; try { value = this.getResources().getAssets().open(spath); } catch { } return value; }; #endregion #region getStringFromInput Func<BufferedReader, string> getStringFromInput = (BufferedReader input) => { StringBuilder sb = new StringBuilder(); string sTemp; try { sTemp = input.readLine(); while (!(sTemp == "")) { sb.append(sTemp + "\n"); sTemp = input.readLine(); } } catch { sb = new StringBuilder(); } return sb.ToString(); }; #endregion #region AtConnection Action<Socket> AtConnection = (clientsocket) => { BufferedReader input = null; OutputStream output = null; try { input = new BufferedReader(new InputStreamReader(clientsocket.getInputStream(), "ISO-8859-2")); output = clientsocket.getOutputStream(); } catch { } #region send_text Action<string> send_text = (s) => { string header = "HTTP/1.1 200 OK\n" + "Connection: close\n" + "Content-type: text/html; charset=utf-8\n"; //"Content-Length: " + s.Length + "\n" + header += "\n"; var w = new OutputStreamWriter(output); try { w.write(header + s); w.flush(); } catch { } }; #endregion #region send_stream Action<InputStream, string> send_stream = (fis, contenttype) => { string header = "HTTP/1.1 200 OK\n"; header += "Expires: Sun, 17 Jan 2038 19:14:07 GMT\n"; header += "Content-type: "; header += contenttype; header += "\n"; //header += "Content-Length: " + fis.available() + "\n" + header += "\n"; try { var w = new OutputStreamWriter(output); w.write(header); w.flush(); sbyte[] buffer = new sbyte[0x10000]; int bytes = 0; bytes = fis.read(buffer); while (bytes != -1) { output.write(buffer, 0, bytes); bytes = fis.read(buffer); } } catch { } }; #endregion new System.Threading.Thread( delegate() { try { string sAll = getStringFromInput(input); var i0 = sAll.IndexOf(" ", 0); var i1 = sAll.IndexOf(" ", i0 + 1); var path = sAll.Substring(i0, i1 - i0); path = path.Replace("%20", " "); if (path.Length > 0) path = path.Substring(2); if (path.Length > 1) { var last = path.Substring(path.Length - 1); if (last == "/") { path = path.Substring(0, path.Length - 1); } } if (this.width > this.height) if (path == "") path = this.ApplicationFile; var asset = openFileFromAssets(path); if (asset != null) { var _get = path; _get += " size: "; _get += ((object)asset.available()).ToString(); Log.i("jsc get", _get); if (path.EndsWith(".gif")) send_stream(asset, "image/gif"); if (path.EndsWith(".htm")) send_stream(asset, "text/html"); else send_stream(asset, "application/octet-stream"); } else { string firstpage = "<body style='padding: 0; margin: 0;'>"; #region AttachQRToElement Action<string, string> AttachQRToElement = (itemuri, Container) => { firstpage += "<script>"; firstpage += "\n"; firstpage += "var i = document.getElementById('"; firstpage += Container; firstpage += "').appendChild( qr.image("; firstpage += "\n"; firstpage += "{value:'"; firstpage += itemuri; firstpage += "'}"; firstpage += "\n"; firstpage += "));"; firstpage += "\n"; firstpage += "</script>"; }; #endregion #region firstpage firstpage += "<script src='/qr.js'></script>"; firstpage += "<center>"; firstpage += "<div style='background-color: black; color: white; padding: 2em;'>"; firstpage += "« Rotate your device to left to <b>launch</b>"; firstpage += "</div>"; firstpage += "<h1>"; firstpage += path; firstpage += "</h1>"; firstpage += "<div id='newdevice'>"; firstpage += "</div>"; AttachQRToElement(this.uri, "newdevice"); firstpage += "<br />"; var ApplicationFileLink = this.uri; ApplicationFileLink += "/"; ApplicationFileLink += this.ApplicationFile; firstpage += "<a"; firstpage += " href='"; firstpage += ApplicationFileLink; firstpage += "' id='ApplicationFile"; firstpage += "'"; firstpage += ">"; firstpage += "<div>"; firstpage += "Connect any other device on the same network to"; firstpage += "</div>"; firstpage += "\n"; firstpage += "<div>"; firstpage += "<code>"; firstpage += this.uri; firstpage += "</code>"; firstpage += "</div>"; firstpage += "</a>"; firstpage += "\n"; firstpage += "<div style='padding: 1em; margin: 0; overflow: hidden;'>"; //ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden var assets = this.getResources().getAssets(); var collection = assets.list(path); var index = 0; #region AtItem Action<string> AtItem = item => { index++; if (!item.Contains(".")) { item += "/"; } firstpage += "<div style='border-top: 0.3em solid black; padding: 1em; '>"; firstpage += "<a"; firstpage += " href='"; firstpage += item; firstpage += "' id='item"; firstpage += ((object)index).ToString(); firstpage += "'"; firstpage += ">"; var path_preview = "assets.preview/"; path_preview += item; path_preview += ".png"; var asset_preview = openFileFromAssets(path_preview); if (asset_preview != null) { firstpage += "<div>"; firstpage += "<img src='"; firstpage += path_preview; firstpage += "' />"; firstpage += "</div>"; } firstpage += "<div>"; firstpage += item; firstpage += "</div>"; firstpage += "\n"; #region WithImage var WithImage = item.EndsWith(".gif"); WithImage |= item.EndsWith(".png"); if (WithImage) { firstpage += "<div>"; firstpage += "<img src='"; firstpage += item; firstpage += "' />"; firstpage += "</div>"; } #endregion firstpage += "</a>"; firstpage += "</div>"; #region WithQR var WithQR = item.EndsWith( ".apk"); if (WithQR) { var ContainerID = "item"; ContainerID += ((object)index).ToString(); var itemuri = this.uri + "/"; itemuri += item; AttachQRToElement(itemuri, ContainerID); } #endregion firstpage += "\n"; }; #endregion foreach (var xitem in collection) { AtItem(xitem); } firstpage += "</center>"; firstpage += "<pre>"; firstpage += sAll; firstpage += "</pre>"; firstpage += "</div>"; firstpage += "</body>"; send_text(firstpage); #endregion } input.close(); output.close(); } catch { } } ).Start(); }; #endregion #region serverThread var serverThread = new System.Threading.Thread( delegate() { try { serversocket = new ServerSocket(port); serversocket.setReuseAddress(true); while (isRunning) { var clientsocket = serversocket.accept(); AtConnection(clientsocket); } } catch { } } ); serverThread.Start(); #endregion #region AtDestroy AtDestroy = delegate { try { if (serversocket != null) serversocket.close(); } catch { } }; #endregion // http://stackoverflow.com/questions/8955228/webview-with-an-iframe-android // http://www.chrisdanielson.com/tag/webviewclient/ this.alertDialog = new AlertDialog.Builder(this).create(); this.progressBar = ProgressDialog.show(this, "Get ready!", "Almost there..." ); #region webview this.webview = new WebView(this); setContentView(webview); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setSupportZoom(true); webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); webview.setInitialScale(ApplicationScale); webview.setWebViewClient(new MyWebViewClient { __this = this }); webview.getSettings().setSupportZoom(false); webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); webview.loadUrl(uri); #endregion }
// http://m0s-programming.blogspot.com/2011/02/file-upload-in-through-webview-on.html //protected void onActivityResult(int requestCode, int resultCode, // Intent intent) //{ // if (requestCode == FILECHOOSER_RESULTCODE) // { // if (null == mUploadMessage) return; // Uri result = intent == null || resultCode != RESULT_OK ? null // : intent.getData(); // mUploadMessage.onReceiveValue(result); // mUploadMessage = null; // } //} protected override void onCreate(Bundle savedInstanceState) { // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2012/20120-1/201208 // this is a prototype implementation for ApplicationWebService on android // we need to serve assets at random port // we need a webbrowser // web browser works. // while loading we could display jsc logo, made in opengl // we need ip and port. // we need to show what assets we have // let's start using HttpRequest base.onCreate(savedInstanceState); #region assets var assets = this.getResources().getAssets(); var aa = new List<InternalFileInfo>(); //var a = new List<InternalFileInfo>(); Action<string> GetAssets = null; GetAssets = (ParentDirectory) => { var collection = new string[0]; Log.wtf("ApplicationWebService", "GetAssets " + ParentDirectory); try { collection = assets.list(ParentDirectory); } catch { } foreach (var RelativeName in collection) { var FileName = string.IsNullOrEmpty(ParentDirectory) ? RelativeName : ParentDirectory + "/" + RelativeName; var IsFile = false; try { var rr = assets.open(FileName); IsFile = true; rr.close(); } catch { } if (IsFile) { aa.Add( new InternalFileInfo { Name = FileName, } ); } if (FileName == "webkit") { } else if (FileName == "sounds") { } else if (FileName == "images") { } else GetAssets(FileName); } }; GetAssets(""); #endregion #region CreateServer at port var r = new System.Random(); var port = r.Next(1024, 32000); var ip = getLocalIpAddress(); var ipa = Dns.GetHostAddresses(getLocalIpAddress())[0]; CreateServer( this, ipa, port, x => { }, aa.ToArray() ).Start(); #endregion #region uri var uri = "http://" + ip; uri += ":"; uri += ((object)(port)).ToString(); //var height = this.getWindowManager().getDefaultDisplay().getHeight(); //var width = this.getWindowManager().getDefaultDisplay().getWidth(); //if (width > height) //{ // this.ToFullscreen(); //} //else uri += "/jsc?flag=foo#bar"; #endregion #region WebView as UI at uri var webview = new WebView(this); webview.getSettings().setJavaScriptEnabled(true); webview.setWebViewClient(new MyWebViewClient { }); webview.setWebChromeClient( new MyWebChromeClient { //AtopenFileChooser = // (ValueCallback<Uri> uploadMsg) => // { // //mUploadMessage = uploadMsg; // //Intent i = new Intent(Intent.ACTION_GET_CONTENT); // //i.addCategory(Intent.CATEGORY_OPENABLE); // //i.setType("image/*"); // //this.startActivityForResult( // // Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE // //); // } } ); this.setContentView(webview); this.AtKeyDown = (keyCode, e) => { if (keyCode == KeyEvent.KEYCODE_BACK) { if (webview.canGoBack()) { webview.goBack(); return true; } } return false; }; this.setTitle(uri); webview.loadUrl(uri); #endregion }
//public ProgressDialog progressBar; //public AlertDialog alertDialog; protected override void onCreate(global::android.os.Bundle savedInstanceState) { base.onCreate(savedInstanceState); //this.ToFullscreen(); // http://stackoverflow.com/questions/8955228/webview-with-an-iframe-android // http://www.chrisdanielson.com/tag/webviewclient/ //this.alertDialog = new AlertDialog.Builder(this).create(); //this.progressBar = ProgressDialog.show(this, "look here!", "Loading..."); this.webview = new WebView(this); // http://googlechromereleases.blogspot.com/2015/03/android-webview-update.html //LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(300, 300); //this.getWindow().setLayoutParams(layoutParams); getWindow().setFlags( WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED); setContentView(webview); //webview.getSettings().setSupportZoom(true); //webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); //webview.setInitialScale(1); webview.setWebViewClient(new MyWebViewClient { __this = this }); //webview.getSettings().setSupportZoom(true); //webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); //var uri = "http://cubiq.org/dropbox/3dcity/"; var uri = "http://webglreport.com/"; webview.loadUrl(uri); //this.ShowToast(uri); #region AtPrepareOptions AtPrepareOptions += value => { value.clear(); var item2 = value.add( (java.lang.CharSequence)(object)uri ); item2.setIcon(android.R.drawable.ic_menu_view); var i = new Intent(Intent.ACTION_VIEW, android.net.Uri.parse(uri) ); // http://vaibhavsarode.wordpress.com/2012/05/14/creating-our-own-activity-launcher-chooser-dialog-android-launcher-selection-dialog/ var ic = Intent.createChooser(i, uri); item2.setIntent( ic ); }; #endregion vConfigurationChanged = e => { var orientation = getScreenOrientation(); var SystemUiVisibility = getWindow().getDecorView().getSystemUiVisibility(); // X:\jsc.svn\examples\java\android\AndroidImmersiveWhileLandscape\AndroidImmersiveWhileLandscape\ApplicationActivity.cs if (orientation == Configuration.ORIENTATION_LANDSCAPE) { hideSystemUI(); } else { showSystemUI(); } }; vConfigurationChanged(null); }
public override void createAndAttachView(int id, FrameLayout frame) { // http://stackoverflow.com/questions/2761577/android-start-an-intent-into-a-framelayout // http://gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity#comment-37 // http://stackoverflow.com/questions/4882776/start-another-activity-inside-the-framelayout-of-tabactivity // Caused by: java.lang.RuntimeException: You must attach your view to the given frame in createAndAttachView() //at wei.mark.standout.ui.Window.<init>(Window.java:154) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) var ll = new LinearLayout( frame.getContext() ); //ll.setAlpha(0.8f); ll.setOrientation(LinearLayout.VERTICAL); var lltab = new LinearLayout( frame.getContext() ); lltab.AttachTo(ll); #region caption var caption = new TextView(frame.getContext()); caption.setText(" XWidgetsWindow"); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android caption.setShadowLayer(1, 0, 0, Color.WHITE); caption.setTextColor(Color.WHITE); caption.setBackgroundColor(Color.BLACK); caption.AttachTo(lltab); #endregion #region close var close = new TextView(frame.getContext()); close.setText(" x "); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android close.setShadowLayer(1, 0, 0, Color.RED); close.setTextColor(Color.RED); close.setBackgroundColor(Color.BLACK); close.AttachTo(lltab); close.setClickable(true); close.AtClick( delegate { this.close(id); } ); #endregion #region WebView var webview = new WebView(frame.getContext()); webview.setAlpha(0.8f); //getWindow().setFlags( // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED, // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED); //setContentView(webview); //webview.getSettings().setSupportZoom(true); //webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); //webview.getSettings().setBuiltInZoomControls(true); //webview.setInitialScale(1); webview.setWebViewClient(new MyWebViewClient { //__this = this }); //webview.getSettings().setSupportZoom(true); //webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); //var uri = "http://cubiq.org/dropbox/3dcity/"; //var uri = "http://abstractatech.com"; var uri = "http://webglreport.com"; webview.loadUrl(uri); #endregion // http://forum.xda-developers.com/showthread.php?t=1688531 var rr = new RelativeLayout(frame.getContext()); webview.AttachTo(rr); #region resizer var resizer = new Button(frame.getContext()); resizer.setText(".:"); resizer.setAlpha(0.4f); resizer.setWidth(72); resizer.setHeight(72); // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code resizer.AttachTo(rr); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT ); p.setMargins(128 + 64, 128 + 64, 0, 0); resizer.setLayoutParams(p); resizer.setOnTouchListener( new __OnTouchListener { yield = (view, e) => { wei.mark.standout.ui.Window ww = getWindow(id); // handle dragging to move var consumed = this.onTouchHandleResize(id, ww, view, e ); { p.setMargins(ww.getWidth() - 64 + 8, ww.getHeight() - 64 - 24, 0, 0); resizer.setLayoutParams(p); } return consumed; } } ); #endregion rr.AttachTo(ll); ll.AttachTo(frame); { //Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to wei.mark.standout.StandOutWindow$StandOutLayoutParams //at wei.mark.example.XWidgetsWindow.createAndAttachView(XWidgetsWindow.java:101) //at wei.mark.standout.ui.Window.<init>(Window.java:150) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) //p.setMargins(ww.getWidth() - 64, ww.getHeight() - 64 - 32, 0, 0); //resizer.setLayoutParams(p); } }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var r = new System.Random(); var port = r.Next(1024, 32000); var uri = "http://" + getLocalIpAddress(); uri += ":"; uri += ((object)(port)).ToString(); this.setTitle((java.lang.CharSequence)(object)uri); serverThread = new ServerThread { mycontext = this, port = port }; new Thread(serverThread).start(); // http://stackoverflow.com/questions/8955228/webview-with-an-iframe-android // http://www.chrisdanielson.com/tag/webviewclient/ this.alertDialog = new AlertDialog.Builder(this).create(); this.progressBar = ProgressDialog.show(this, (CharSequence)(object)"look here!", (CharSequence)(object)"Loading..."); this.webview = new WebView(this); setContentView(webview); //webview.getSettings().setSupportZoom(true); webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); //webview.setInitialScale(1); webview.setWebViewClient(new MyWebViewClient { __this = this }); webview.getSettings().setSupportZoom(false); webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); webview.loadUrl(uri); //this.setContentView(sv); }