summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
diff options
context:
space:
mode:
authorkingces95 <kingces95@users.noreply.github.com>2017-03-07 19:56:24 (GMT)
committerGitHub <noreply@github.com>2017-03-07 19:56:24 (GMT)
commite6d5186c8acbf37b877c7ca3c77a378352a3743d (patch)
treed61ca8ea619f7844e9e0a973dbd7bac794e39147 /Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
parent2b92142ab2a501de71d3572efc0e5deb2b7bae9a (diff)
downloadxamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.zip
xamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.tar.gz
xamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.tar.bz2
Remove InternalsVisibleTo from Core to XF.Platforms.* (#782)
* Remove InternalsVisibleTo from Core to XF.Platforms.* * Changes per Jason's code review * Move LockableObservableListWrapper to internals namespace * Changes per Stephane's code review * update docs * Touch code to get CI to run tests * Rebase; Update documentation
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs32
1 files changed, 18 insertions, 14 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
index 8efc41e..9e49a90 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
@@ -12,6 +12,8 @@ namespace Xamarin.Forms.Platform.Android
bool _ignoreSourceChanges;
FormsWebChromeClient _webChromeClient;
+ IWebViewController ElementController => Element;
+
public WebViewRenderer()
{
AutoPackage = false;
@@ -35,9 +37,9 @@ namespace Xamarin.Forms.Platform.Android
{
if (Control != null)
Control.StopLoading();
- Element.EvalRequested -= OnEvalRequested;
- Element.GoBackRequested -= OnGoBackRequested;
- Element.GoForwardRequested -= OnGoForwardRequested;
+ ElementController.EvalRequested -= OnEvalRequested;
+ ElementController.GoBackRequested -= OnGoBackRequested;
+ ElementController.GoForwardRequested -= OnGoForwardRequested;
_webChromeClient?.Dispose();
}
@@ -84,16 +86,18 @@ namespace Xamarin.Forms.Platform.Android
if (e.OldElement != null)
{
- e.OldElement.EvalRequested -= OnEvalRequested;
- e.OldElement.GoBackRequested -= OnGoBackRequested;
- e.OldElement.GoForwardRequested -= OnGoForwardRequested;
+ var oldElementController = e.OldElement as IWebViewController;
+ oldElementController.EvalRequested -= OnEvalRequested;
+ oldElementController.GoBackRequested -= OnGoBackRequested;
+ oldElementController.GoForwardRequested -= OnGoForwardRequested;
}
if (e.NewElement != null)
{
- e.NewElement.EvalRequested += OnEvalRequested;
- e.NewElement.GoBackRequested += OnGoBackRequested;
- e.NewElement.GoForwardRequested += OnGoForwardRequested;
+ var newElementController = e.NewElement as IWebViewController;
+ newElementController.EvalRequested += OnEvalRequested;
+ newElementController.GoBackRequested += OnGoBackRequested;
+ newElementController.GoForwardRequested += OnGoForwardRequested;
}
Load();
@@ -147,8 +151,8 @@ namespace Xamarin.Forms.Platform.Android
{
if (Element == null || Control == null)
return;
- Element.CanGoBack = Control.CanGoBack();
- Element.CanGoForward = Control.CanGoForward();
+ ElementController.CanGoBack = Control.CanGoBack();
+ ElementController.CanGoForward = Control.CanGoForward();
}
class WebClient : WebViewClient
@@ -170,12 +174,12 @@ namespace Xamarin.Forms.Platform.Android
var source = new UrlWebViewSource { Url = url };
_renderer._ignoreSourceChanges = true;
- ((IElementController)_renderer.Element).SetValueFromRenderer(WebView.SourceProperty, source);
+ _renderer.ElementController.SetValueFromRenderer(WebView.SourceProperty, source);
_renderer._ignoreSourceChanges = false;
var args = new WebNavigatedEventArgs(WebNavigationEvent.NewPage, source, url, _navigationResult);
- _renderer.Element.SendNavigated(args);
+ _renderer.ElementController.SendNavigated(args);
_renderer.UpdateCanGoBackForward();
@@ -209,7 +213,7 @@ namespace Xamarin.Forms.Platform.Android
var args = new WebNavigatingEventArgs(WebNavigationEvent.NewPage, new UrlWebViewSource { Url = url }, url);
- _renderer.Element.SendNavigating(args);
+ _renderer.ElementController.SendNavigating(args);
_navigationResult = WebNavigationResult.Success;
_renderer.UpdateCanGoBackForward();