summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers/GenericAnimatorListener.cs
blob: c89f007c941de8d6f66171171a6f155527e8b5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();
		}
	}
}