diff options
author | kingces95 <kingces95@users.noreply.github.com> | 2017-03-07 14:56:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-07 14:56:24 -0500 |
commit | e6d5186c8acbf37b877c7ca3c77a378352a3743d (patch) | |
tree | d61ca8ea619f7844e9e0a973dbd7bac794e39147 /Xamarin.Forms.Platform.Android | |
parent | 2b92142ab2a501de71d3572efc0e5deb2b7bae9a (diff) | |
download | xamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.tar.gz xamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.tar.bz2 xamarin-forms-e6d5186c8acbf37b877c7ca3c77a378352a3743d.zip |
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')
31 files changed, 75 insertions, 42 deletions
diff --git a/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs b/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs index e9b85eec..9d43904e 100644 --- a/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs +++ b/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs @@ -3,6 +3,7 @@ using System; using System.Reflection; using System.Linq; using System.Globalization; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs index aef56e11..61552f54 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs @@ -7,6 +7,7 @@ using Android.Graphics.Drawables; using Android.Support.V4.Content; using Android.Support.V7.Widget; using Android.Util; +using Xamarin.Forms.Internals; using GlobalResource = Android.Resource; using Object = Java.Lang.Object; using AView = Android.Views.View; @@ -31,12 +32,12 @@ namespace Xamarin.Forms.Platform.Android.AppCompat global::Android.Widget.Button NativeButton => Control; - void IOnAttachStateChangeListener.OnViewAttachedToWindow(AView attachedView) + void AView.IOnAttachStateChangeListener.OnViewAttachedToWindow(AView attachedView) { UpdateText(); } - void IOnAttachStateChangeListener.OnViewDetachedFromWindow(AView detachedView) + void AView.IOnAttachStateChangeListener.OnViewDetachedFromWindow(AView detachedView) { } @@ -161,7 +162,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat } catch (Exception ex) { - Log.Warning("Xamarin.Forms.Platform.Android.ButtonRenderer", "Could not retrieve button background resource: {0}", ex); + Internals.Log.Warning("Xamarin.Forms.Platform.Android.ButtonRenderer", "Could not retrieve button background resource: {0}", ex); Control.SupportBackgroundTintList = new ColorStateList(ColorExtensions.States, new[] { (int)0xffd7d6d6, 0x7fd7d6d6 }); } } @@ -289,7 +290,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat _textColorSwitcher?.UpdateTextColor(Control, Element.TextColor); } - class ButtonClickListener : Object, IOnClickListener + class ButtonClickListener : Object, AView.IOnClickListener { #region Statics @@ -304,7 +305,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat } } - class ButtonTouchListener : Object, IOnTouchListener + class ButtonTouchListener : Object, AView.IOnTouchListener { public static readonly Lazy<ButtonTouchListener> Instance = new Lazy<ButtonTouchListener>(() => new ButtonTouchListener()); diff --git a/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs index fb6d5b55..f7a48d9b 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs @@ -91,13 +91,13 @@ namespace Xamarin.Forms.Platform.Android.AppCompat { OverScrollMode = OverScrollMode.Never, EnableGesture = true, - LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent), + LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent), Adapter = new FormsFragmentPagerAdapter<ContentPage>(e.NewElement, activity.SupportFragmentManager) { CountOverride = e.NewElement.Children.Count } }; pager.Id = FormsAppCompatActivity.GetUniqueId(); pager.AddOnPageChangeListener(this); - AddView(pager); + ViewGroup.AddView(pager); CarouselPage carouselPage = e.NewElement; if (carouselPage.CurrentPage != null) ScrollToCurrentPage(); diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs index 223d3a83..4d588218 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs @@ -21,6 +21,7 @@ using AToolbar = Android.Support.V7.Widget.Toolbar; using AColor = Android.Graphics.Color; using AlertDialog = Android.Support.V7.App.AlertDialog; using ARelativeLayout = Android.Widget.RelativeLayout; +using Xamarin.Forms.Internals; #endregion @@ -56,6 +57,8 @@ namespace Xamarin.Forms.Platform.Android _currentState = AndroidApplicationLifecycleState.Uninitialized; } + IApplicationController Controller => _application; + public event EventHandler ConfigurationChanged; int IStartActivityForResult.RegisterActivityResultCallback(Action<Result, Intent> callback) @@ -126,7 +129,7 @@ namespace Xamarin.Forms.Platform.Android _application = application; (application as IApplicationController)?.SetAppIndexingProvider(new AndroidAppIndexProvider(this)); - Xamarin.Forms.Application.Current = application; + Xamarin.Forms.Application.SetCurrentApplication(application); SetSoftInputMode(); @@ -354,7 +357,7 @@ namespace Xamarin.Forms.Platform.Android } catch (Exception ex) { - Log.Warning("Xamarin.Forms.Platform.Android.FormsAppCompatActivity", "Error retrieving color resource: {0}", ex); + Internals.Log.Warning("Xamarin.Forms.Platform.Android.FormsAppCompatActivity", "Error retrieving color resource: {0}", ex); } return -1; diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FormsFragmentPagerAdapter.cs b/Xamarin.Forms.Platform.Android/AppCompat/FormsFragmentPagerAdapter.cs index 99fbb396..968695df 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/FormsFragmentPagerAdapter.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/FormsFragmentPagerAdapter.cs @@ -1,6 +1,7 @@ using Android.OS; using Android.Support.V4.App; using Java.Lang; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android.AppCompat { diff --git a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs index eb23c4de..69365c63 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs @@ -6,6 +6,7 @@ using Android.Content; using Android.Views; using Android.Views.Animations; using ARelativeLayout = Android.Widget.RelativeLayout; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android.AppCompat { diff --git a/Xamarin.Forms.Platform.Android/Deserializer.cs b/Xamarin.Forms.Platform.Android/Deserializer.cs index b1eafa88..c85aaa73 100644 --- a/Xamarin.Forms.Platform.Android/Deserializer.cs +++ b/Xamarin.Forms.Platform.Android/Deserializer.cs @@ -5,6 +5,7 @@ using System.IO.IsolatedStorage; using System.Runtime.Serialization; using System.Threading.Tasks; using System.Xml; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Extensions.cs b/Xamarin.Forms.Platform.Android/Extensions.cs index c326555a..227f9841 100644 --- a/Xamarin.Forms.Platform.Android/Extensions.cs +++ b/Xamarin.Forms.Platform.Android/Extensions.cs @@ -1,5 +1,6 @@ using Android.Content.Res; using Android.Views; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs b/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs index fd072461..2182397b 100644 --- a/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs +++ b/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs index c2352359..8d336191 100644 --- a/Xamarin.Forms.Platform.Android/Forms.cs +++ b/Xamarin.Forms.Platform.Android/Forms.cs @@ -115,10 +115,10 @@ namespace Xamarin.Forms ResourceManager.Init(resourceAssembly); - Color.Accent = GetAccentColor(); + Color.SetAccent(GetAccentColor()); if (!IsInitialized) - Log.Listeners.Add(new DelegateLogListener((c, m) => Trace.WriteLine(m, c))); + Internals.Log.Listeners.Add(new DelegateLogListener((c, m) => Trace.WriteLine(m, c))); Device.PlatformServices = new AndroidPlatformServices(); @@ -134,7 +134,7 @@ namespace Xamarin.Forms var ticker = Ticker.Default as AndroidTicker; if (ticker != null) ticker.Dispose(); - Ticker.Default = new AndroidTicker(); + Ticker.SetDefault(new AndroidTicker()); if (!IsInitialized) { @@ -143,7 +143,7 @@ namespace Xamarin.Forms int minWidthDp = Context.Resources.Configuration.SmallestScreenWidthDp; - Device.Idiom = minWidthDp >= TabletCrossover ? TargetIdiom.Tablet : TargetIdiom.Phone; + Device.SetIdiom(minWidthDp >= TabletCrossover ? TargetIdiom.Tablet : TargetIdiom.Phone); if (ExpressionSearch.Default == null) ExpressionSearch.Default = new AndroidExpressionSearch(); @@ -387,7 +387,7 @@ namespace Xamarin.Forms { if (!response.IsSuccessStatusCode) { - Log.Warning("HTTP Request", $"Could not retrieve {uri}, status code {response.StatusCode}"); + Internals.Log.Warning("HTTP Request", $"Could not retrieve {uri}, status code {response.StatusCode}"); return null; } return await response.Content.ReadAsStreamAsync(); @@ -468,7 +468,7 @@ namespace Xamarin.Forms } catch (Exception ex) { - Log.Warning("Xamarin.Forms.Platform.Android.AndroidPlatformServices", "Error retrieving text appearance: {0}", ex); + Internals.Log.Warning("Xamarin.Forms.Platform.Android.AndroidPlatformServices", "Error retrieving text appearance: {0}", ex); } return false; } @@ -503,13 +503,13 @@ namespace Xamarin.Forms return Task.FromResult(_isolatedStorageFile.GetLastWriteTime(path)); } - public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access) + public Task<Stream> OpenFileAsync(string path, Internals.FileMode mode, Internals.FileAccess access) { Stream stream = _isolatedStorageFile.OpenFile(path, (System.IO.FileMode)mode, (System.IO.FileAccess)access); return Task.FromResult(stream); } - public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access, FileShare share) + public Task<Stream> OpenFileAsync(string path, Internals.FileMode mode, Internals.FileAccess access, Internals.FileShare share) { Stream stream = _isolatedStorageFile.OpenFile(path, (System.IO.FileMode)mode, (System.IO.FileAccess)access, (System.IO.FileShare)share); return Task.FromResult(stream); diff --git a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs index fb1fa174..6e508cc4 100644 --- a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs +++ b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs @@ -9,6 +9,7 @@ using Android.OS; using Android.Views; using Android.Widget; using Xamarin.Forms.PlatformConfiguration.AndroidSpecific; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { @@ -105,7 +106,7 @@ namespace Xamarin.Forms.Platform.Android (application as IApplicationController)?.SetAppIndexingProvider(new AndroidAppIndexProvider(this)); _application = application; - Xamarin.Forms.Application.Current = application; + Xamarin.Forms.Application.SetCurrentApplication(application); SetSoftInputMode(); diff --git a/Xamarin.Forms.Platform.Android/NativeBindingservice.cs b/Xamarin.Forms.Platform.Android/NativeBindingservice.cs index 3dd4fe3c..f67b2a9a 100644 --- a/Xamarin.Forms.Platform.Android/NativeBindingservice.cs +++ b/Xamarin.Forms.Platform.Android/NativeBindingservice.cs @@ -1,11 +1,12 @@ using System; +using Xamarin.Forms.Xaml.Internals; using AView = Android.Views.View; [assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.Android.NativeBindingService))] namespace Xamarin.Forms.Platform.Android { - class NativeBindingService : Xaml.INativeBindingService + class NativeBindingService : INativeBindingService { public bool TrySetBinding(object target, string propertyName, BindingBase binding) { diff --git a/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs b/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs index ff6faa90..69cccd94 100644 --- a/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs +++ b/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs @@ -1,10 +1,11 @@ using System; +using Xamarin.Forms.Xaml.Internals; using AView = Android.Views.View; [assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.Android.NativeValueConverterService))] namespace Xamarin.Forms.Platform.Android { - class NativeValueConverterService : Xaml.INativeValueConverterService + class NativeValueConverterService : INativeValueConverterService { public bool ConvertTo(object value, Type toType, out object nativeValue) { diff --git a/Xamarin.Forms.Platform.Android/PanGestureHandler.cs b/Xamarin.Forms.Platform.Android/PanGestureHandler.cs index a552964c..0837f633 100644 --- a/Xamarin.Forms.Platform.Android/PanGestureHandler.cs +++ b/Xamarin.Forms.Platform.Android/PanGestureHandler.cs @@ -1,4 +1,5 @@ using System; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/PinchGestureHandler.cs b/Xamarin.Forms.Platform.Android/PinchGestureHandler.cs index bc06531c..c315b92c 100644 --- a/Xamarin.Forms.Platform.Android/PinchGestureHandler.cs +++ b/Xamarin.Forms.Platform.Android/PinchGestureHandler.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/RendererPool.cs b/Xamarin.Forms.Platform.Android/RendererPool.cs index 447de3fd..48665c81 100644 --- a/Xamarin.Forms.Platform.Android/RendererPool.cs +++ b/Xamarin.Forms.Platform.Android/RendererPool.cs @@ -35,7 +35,7 @@ namespace Xamarin.Forms.Platform.Android if (view == null) throw new ArgumentNullException("view"); - Type rendererType = Registrar.Registered.GetHandlerType(view.GetType()) ?? typeof(ViewRenderer); + Type rendererType = Internals.Registrar.Registered.GetHandlerType(view.GetType()) ?? typeof(ViewRenderer); Stack<IVisualElementRenderer> renderers; if (!_freeRenderers.TryGetValue(rendererType, out renderers) || renderers.Count == 0) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs index 8495d807..8c937f4c 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs @@ -6,6 +6,7 @@ using Android.Views; using Android.Widget; using AButton = Android.Widget.Button; using AView = Android.Views.View; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs index b7e98bae..efee571d 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs @@ -4,6 +4,7 @@ using System.Linq; using Android.Content; using Android.Support.V4.View; using Android.Views; +using Xamarin.Forms.Internals; using Object = Java.Lang.Object; namespace Xamarin.Forms.Platform.Android diff --git a/Xamarin.Forms.Platform.Android/Renderers/FontExtensions.cs b/Xamarin.Forms.Platform.Android/Renderers/FontExtensions.cs index 981065b7..75238a36 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/FontExtensions.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/FontExtensions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using Android.Graphics; using AApplication = Android.App.Application; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs index fe91d588..e18d4b95 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using Android.Graphics; using AImageView = Android.Widget.ImageView; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { @@ -82,7 +83,7 @@ namespace Xamarin.Forms.Platform.Android Bitmap bitmap = null; IImageSourceHandler handler; - if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) + if (source != null && (handler = Internals.Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) { try { diff --git a/Xamarin.Forms.Platform.Android/Renderers/KeyboardExtensions.cs b/Xamarin.Forms.Platform.Android/Renderers/KeyboardExtensions.cs index 6941422d..9a22e641 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/KeyboardExtensions.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/KeyboardExtensions.cs @@ -1,4 +1,5 @@ using Android.Text; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs index 7e28392f..a7bebf1e 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailContainer.cs @@ -5,6 +5,7 @@ using Android.Content.Res; using Android.Runtime; using Android.Views; using Android.Widget; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/Renderers/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/NavigationMenuRenderer.cs index c7e45ad9..ea43a43b 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/NavigationMenuRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/NavigationMenuRenderer.cs @@ -6,6 +6,7 @@ using Android.Graphics; using Android.Views; using Android.Widget; using AView = Android.Views.View; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { @@ -115,6 +116,8 @@ namespace Xamarin.Forms.Platform.Android { readonly NavigationMenu _menu; + INavigationMenuController MenuController => _menu; + public MenuAdapter(NavigationMenu menu) { _menu = menu; @@ -135,7 +138,7 @@ namespace Xamarin.Forms.Platform.Android Page item = this[position]; menuItem.Icon = item.Icon; menuItem.Name = item.Title; - menuItem.OnSelected = () => _menu.SendTargetSelected(item); + menuItem.OnSelected = () => MenuController.SendTargetSelected(item); return menuItem; } diff --git a/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs index 8efc41e1..9e49a904 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(); diff --git a/Xamarin.Forms.Platform.Android/ResourceManager.cs b/Xamarin.Forms.Platform.Android/ResourceManager.cs index 397b3c27..0fdccaef 100644 --- a/Xamarin.Forms.Platform.Android/ResourceManager.cs +++ b/Xamarin.Forms.Platform.Android/ResourceManager.cs @@ -7,6 +7,7 @@ using Android.Graphics; using Android.Graphics.Drawables; using Android.Support.V4.Content; using Path = System.IO.Path; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/ResourcesProvider.cs b/Xamarin.Forms.Platform.Android/ResourcesProvider.cs index 5c7e1de3..7af55494 100644 --- a/Xamarin.Forms.Platform.Android/ResourcesProvider.cs +++ b/Xamarin.Forms.Platform.Android/ResourcesProvider.cs @@ -1,6 +1,7 @@ using Android.Content; using Android.Content.Res; using Android.Util; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/TapGestureHandler.cs b/Xamarin.Forms.Platform.Android/TapGestureHandler.cs index dcd8d6f7..0dd63262 100644 --- a/Xamarin.Forms.Platform.Android/TapGestureHandler.cs +++ b/Xamarin.Forms.Platform.Android/TapGestureHandler.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { diff --git a/Xamarin.Forms.Platform.Android/ViewRenderer.cs b/Xamarin.Forms.Platform.Android/ViewRenderer.cs index ee5913b1..842fc5c2 100644 --- a/Xamarin.Forms.Platform.Android/ViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/ViewRenderer.cs @@ -32,7 +32,7 @@ namespace Xamarin.Forms.Platform.Android public TNativeView Control { get; private set; } - void IOnFocusChangeListener.OnFocusChange(AView v, bool hasFocus) + void AView.IOnFocusChangeListener.OnFocusChange(AView v, bool hasFocus) { if (Element is Entry || Element is SearchBar || Element is Editor) { @@ -146,7 +146,7 @@ namespace Xamarin.Forms.Platform.Android protected override void OnRegisterEffect(PlatformEffect effect) { base.OnRegisterEffect(effect); - effect.Control = Control; + effect.SetControl(Control); } protected override void SetAutomationId(string id) diff --git a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs index 0ad1b424..0e08cfed 100644 --- a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs +++ b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using Xamarin.Forms.Internals; using AView = Android.Views.View; namespace Xamarin.Forms.Platform.Android diff --git a/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs index 3986a6db..7f5c7f91 100644 --- a/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs @@ -85,7 +85,7 @@ namespace Xamarin.Forms.Platform.Android OnRegisterEffect(platformEffect); } - void IOnClickListener.OnClick(AView v) + void AView.IOnClickListener.OnClick(AView v) { _tapGestureHandler.OnSingleClick(); } @@ -98,7 +98,7 @@ namespace Xamarin.Forms.Platform.Android return base.OnInterceptTouchEvent(ev); } - bool IOnTouchListener.OnTouch(AView v, MotionEvent e) + bool AView.IOnTouchListener.OnTouch(AView v, MotionEvent e) { var handled = false; if (_pinchGestureHandler.IsPinchSupported) @@ -334,7 +334,7 @@ namespace Xamarin.Forms.Platform.Android protected virtual void OnRegisterEffect(PlatformEffect effect) { - effect.Container = this; + effect.SetContainer(this); } protected virtual void SetAutomationId(string id) diff --git a/Xamarin.Forms.Platform.Android/VisualElementTracker.cs b/Xamarin.Forms.Platform.Android/VisualElementTracker.cs index 34c362d6..77404da8 100644 --- a/Xamarin.Forms.Platform.Android/VisualElementTracker.cs +++ b/Xamarin.Forms.Platform.Android/VisualElementTracker.cs @@ -6,6 +6,7 @@ using Android.OS; using Android.Views; using AView = Android.Views.View; using Object = Java.Lang.Object; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.Android { |