Ejemplo n.º 1
0
        public static void Launch(Context context, string url, bool launchInBrowser = true, string title = "")
        {
            Intent intent;

            if (launchInBrowser)
            {
                intent = new Intent(Intent.ActionView, AndroidUri.Parse(url));
            }
            else
            {
                intent = WebViewActivity.NewIntent(context, title, url);
            }

            context.StartActivity(intent);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute asynchronously a function and trigger a custom Javascript event in the UI Web View to notify the end of the execution
        /// </summary>
        /// <param name="context">Activity containing the Web View</param>
        /// <param name="function">The function to execute. This function retrieves a string. This string should be a stringified JSON</param>
        /// <param name="callbackEventId">The id to identify the callback result from the UI Web View</param>
        public static void ExecuteAsync(WebViewActivity context, Func <string> function, string callbackEventId)
        {
            System.Threading.Tasks.Task.Run(() =>
            {
                var result = function();

                var asyncCallResult = new
                {
                    CallId = callbackEventId,
                    Result = result
                };

                var script = "document.dispatchEvent(new CustomEvent('asyncCallfinished',{ 'detail': " + JsonHelper.ToJson(asyncCallResult) + " }));";
                context.ExecuteJavaScript(script);
            });
        }
Ejemplo n.º 3
0
 public JavascriptWebViewInterface(WebViewActivity context)
 {
     Context = context;
 }
Ejemplo n.º 4
0
 public MyWebViewClient(WebViewActivity webViewActivity)
 {
     this.webViewActivity = webViewActivity;
 }
Ejemplo n.º 5
0
 public JavascriptPhoneInterface(WebViewActivity context) : base(context)
 {
 }