diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs b/Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs new file mode 100644 index 00000000..c89f007c --- /dev/null +++ b/Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs @@ -0,0 +1,41 @@ +using System; +using Android.Animation; + +namespace Xamarin.Forms.Platform.Android +{ + public class GenericAnimatorListener : AnimatorListenerAdapter + { + public Action<Animator> OnCancel { get; set; } + + public Action<Animator> OnEnd { get; set; } + + public Action<Animator> OnRepeat { get; set; } + + public override void OnAnimationCancel(Animator animation) + { + if (OnCancel != null) + OnCancel(animation); + base.OnAnimationCancel(animation); + } + + public override void OnAnimationEnd(Animator animation) + { + if (OnEnd != null) + OnEnd(animation); + base.OnAnimationEnd(animation); + } + + public override void OnAnimationRepeat(Animator animation) + { + if (OnRepeat != null) + OnRepeat(animation); + base.OnAnimationRepeat(animation); + } + + protected override void JavaFinalize() + { + OnCancel = OnRepeat = OnEnd = null; + base.JavaFinalize(); + } + } +}
\ No newline at end of file |