public void SetOpened(bool opened, bool animated = true) { this.opened = opened; if (!animated) SetNewOffset (opened ? MaxOffset : 0); else { if (animator != null) { animator.Cancel (); animator = null; } animator = ValueAnimator.OfInt (contentOffsetX, opened ? MaxOffset : 0); animator.SetInterpolator (interpolator); animator.SetDuration (Context.Resources.GetInteger (Android.Resource.Integer.ConfigMediumAnimTime)); animator.Update += (sender, e) => SetNewOffset ((int)e.Animation.AnimatedValue); animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners (); animator = null; }; animator.Start (); } }
public void SetOrientation(ArrowOrientation orientation, bool animate = true) { Orientation = orientation; animator = ValueAnimator.OfFloat (0f, 1f); animator.SetDuration (250); animator.Update += (sender, e) => Alpha = (float)e.Animation.AnimatedValue; animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners (); animator = null; }; animator.Start (); }