Example #1
0
            protected override string RunInBackground(params string[] @params)
            {
                try
                {
                    var markdown = "";
                    var url      = @params[0];
                    this.cssFileUrl = @params[1];
                    if (URLUtil.IsNetworkUrl(url))
                    {
                        HttpClient c = new HttpClient();
                        markdown = MyIssues.Util.AsyncHelpers.RunSync(() => c.GetStringAsync(new Uri(url)));
                    }
                    else if (URLUtil.IsAssetUrl(url))
                    {
                        markdown = _parent.ReadFileFromAsset(url.Substring("file:///android_asset/".Length));
                        //throw new NotImplementedException();
                    }
                    else
                    {
                        throw new ArgumentException("The URL string provided is not a network URL or Asset URL.", nameof(url));
                    }

                    return(markdown);
                }
                catch (Exception ex)
                {
                    Log.Debug(TAG, "Error Loading Markdown File.", ex);
                    return(null);
                }
            }
Example #2
0
 public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest request)
 {
     if (URLUtil.IsNetworkUrl(request.Url.ToString()))
     {
         return(false);
     }
     _activity.StartActivity(new Intent(Intent.ActionView, request.Url));
     return(true);
 }