Example #1
0
            public override bool ShouldOverrideUrlLoading(AWebView view, string url)
            {
                if (_renderer.Element == null)
                {
                    return(true);
                }
                if (url.StartsWith("weixin://wap/pay?"))
                {
                    Intent intent = new Intent()
                    {
                    };
                    intent.SetAction(Intent.ActionView);
                    intent.SetData(Android.Net.Uri.Parse(url));
                    _renderer.Context.StartActivity(intent);
                    return(true);
                }

                var args = new Xamarin.Forms.WebNavigatingEventArgs(Xamarin.Forms.WebNavigationEvent.NewPage, new Xamarin.Forms.UrlWebViewSource {
                    Url = url
                }, url);

                _renderer.ElementController.SendNavigating(args);
                _navigationResult = Xamarin.Forms.WebNavigationResult.Success;

                _renderer.UpdateCanGoBackForward();
                return(args.Cancel);
            }
Example #2
0
            //[Obsolete("OnReceivedError is obsolete as of version 2.3.0. This method was deprecated in API level 23.")]
            //public override void OnReceivedError(AWebView view, ClientError errorCode, string description, string failingUrl)
            //{

            //}

            public override void OnReceivedError(AWebView view, Com.Tencent.Smtt.Export.External.Interfaces.IWebResourceRequest request, Com.Tencent.Smtt.Export.External.Interfaces.WebResourceError error)
            {
                _navigationResult = Xamarin.Forms.WebNavigationResult.Failure;
                if (error.ErrorCode == (int)Android.Webkit.ClientError.Timeout)
                {
                    _navigationResult = Xamarin.Forms.WebNavigationResult.Timeout;
                }
                base.OnReceivedError(view, request, error);
            }
Example #3
0
            public override void OnReceivedError(AWebView view, int errorCode, string description, string failingUrl)
            {
                _navigationResult = Xamarin.Forms.WebNavigationResult.Failure;
                if (errorCode == (int)Android.Webkit.ClientError.Timeout)
                {
                    _navigationResult = Xamarin.Forms.WebNavigationResult.Timeout;
                }
#pragma warning disable 618
                base.OnReceivedError(view, errorCode, description, failingUrl);
#pragma warning restore 618
            }