diff options
author | Samantha Houts <samhouts@users.noreply.github.com> | 2017-03-23 16:12:41 -0700 |
---|---|---|
committer | E.Z. Hart <hartez@users.noreply.github.com> | 2017-03-23 17:12:41 -0600 |
commit | 79ecf97d92331c790b5ba5c99f453607260f40cb (patch) | |
tree | 684071dda7a8ae360de7616b724438f1244b5547 /Xamarin.Forms.Platform.Android | |
parent | f27f5a3650f37894d4a1ac925d6fab4dc7350087 (diff) | |
download | xamarin-forms-79ecf97d92331c790b5ba5c99f453607260f40cb.tar.gz xamarin-forms-79ecf97d92331c790b5ba5c99f453607260f40cb.tar.bz2 xamarin-forms-79ecf97d92331c790b5ba5c99f453607260f40cb.zip |
[Android] ScrollView can now consume Effects (#836)
* Add repro
* [Android] Make ScrollView an IEffectControlProvider
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/ScrollViewRenderer.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ScrollViewRenderer.cs index a2e3ddb3..b7961411 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ScrollViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ScrollViewRenderer.cs @@ -5,11 +5,12 @@ using Android.Animation; using Android.Graphics; using Android.Views; using Android.Widget; +using Xamarin.Forms.Internals; using AScrollView = Android.Widget.ScrollView; namespace Xamarin.Forms.Platform.Android { - public class ScrollViewRenderer : AScrollView, IVisualElementRenderer + public class ScrollViewRenderer : AScrollView, IVisualElementRenderer, IEffectControlProvider { ScrollViewContainer _container; HorizontalScrollView _hScrollView; @@ -77,6 +78,8 @@ namespace Xamarin.Forms.Platform.Android if (!string.IsNullOrEmpty(element.AutomationId)) ContentDescription = element.AutomationId; } + + EffectUtilities.RegisterEffectControlProvider(this, oldElement, element); } public VisualElementTracker Tracker { get; private set; } @@ -216,6 +219,19 @@ namespace Xamarin.Forms.Platform.Android } } + void IEffectControlProvider.RegisterEffect(Effect effect) + { + var platformEffect = effect as PlatformEffect; + if (platformEffect != null) + OnRegisterEffect(platformEffect); + } + + void OnRegisterEffect(PlatformEffect effect) + { + effect.SetContainer(this); + effect.SetControl(this); + } + static int GetDistance(double start, double position, double v) { return (int)(start + (position - start) * v); |