[Android] Remove changes to IVisualElementRenderer so it remains backwards compatible (#5398)

* return IVisualElementRenderer to previous state

* set to internal
This commit is contained in:
Shane Neuville 2019-02-28 11:57:20 -07:00 коммит произвёл Samantha Houts
Родитель a08e954eaa
Коммит 70a2a628a5
7 изменённых файлов: 20 добавлений и 12 удалений

Просмотреть файл

@ -21,7 +21,8 @@ namespace Xamarin.Forms.Platform.Android
IImageRendererController,
AView.IOnFocusChangeListener,
AView.IOnClickListener,
AView.IOnTouchListener
AView.IOnTouchListener,
ILayoutChanges
{
bool _inputTransparent;
bool _disposed;

Просмотреть файл

@ -15,7 +15,9 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
{
renderer.ElementPropertyChanged += OnElementPropertyChanged;
renderer.ElementChanged += OnElementChanged;
renderer.LayoutChange += OnLayoutChange;
if(renderer is ILayoutChanges layoutChanges)
layoutChanges.LayoutChange += OnLayoutChange;
}
static void OnLayoutChange(object sender, global::Android.Views.View.LayoutChangeEventArgs e)
@ -28,7 +30,8 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
{
renderer.ElementPropertyChanged -= OnElementPropertyChanged;
renderer.ElementChanged -= OnElementChanged;
renderer.LayoutChange -= OnLayoutChange;
if (renderer is ILayoutChanges layoutChanges)
layoutChanges.LayoutChange -= OnLayoutChange;
if (renderer.View is ImageView imageView)
imageView.SetImageDrawable(null);

Просмотреть файл

@ -11,7 +11,8 @@ using Android.Support.V4.View;
namespace Xamarin.Forms.Platform.Android.FastRenderers
{
internal sealed class ImageRenderer : AImageView, IVisualElementRenderer, IImageRendererController, IViewRenderer, ITabStop
internal sealed class ImageRenderer : AImageView, IVisualElementRenderer, IImageRendererController, IViewRenderer, ITabStop,
ILayoutChanges
{
bool _disposed;
Image _element;

Просмотреть файл

@ -0,0 +1,10 @@
using System;
using ALayoutChangeEventArgs = Android.Views.View.LayoutChangeEventArgs;
namespace Xamarin.Forms.Platform.Android
{
internal interface ILayoutChanges
{
event EventHandler<ALayoutChangeEventArgs> LayoutChange;
}
}

Просмотреть файл

@ -29,7 +29,5 @@ namespace Xamarin.Forms.Platform.Android
void SetLabelFor(int? id);
void UpdateLayout();
event EventHandler<ALayoutChangeEventArgs> LayoutChange;
}
}

Просмотреть файл

@ -31,12 +31,6 @@ namespace Xamarin.Forms.Platform.Android
remove { _elementPropertyChanged -= value; }
}
event EventHandler<AView.LayoutChangeEventArgs> IVisualElementRenderer.LayoutChange
{
add =>_flyoutRenderer.AndroidView.LayoutChange += value;
remove => _flyoutRenderer.AndroidView.LayoutChange -= value;
}
VisualElement IVisualElementRenderer.Element => Element;
VisualElementTracker IVisualElementRenderer.Tracker => null;

Просмотреть файл

@ -144,6 +144,7 @@
<Compile Include="GetDesiredSizeDelegate.cs" />
<Compile Include="IBorderVisualElementRenderer.cs" />
<Compile Include="IDeviceInfoProvider.cs" />
<Compile Include="ILayoutChanges.cs" />
<Compile Include="ITabStop.cs" />
<Compile Include="IPickerRenderer.cs" />
<Compile Include="PickerManager.cs" />