示例#1
0
        private void RunCountdown(int countdownTime, Action onFinished)
        {
            UpdateCountdownLabel(countdownTime);
            ViewPropertyAnimator animator = _label.Animate().ScaleX(0).ScaleY(0).Alpha(0.0f).SetDuration(1000);

            if (countdownTime > 0)
            {
                animator.WithEndAction(new Runnable(() => RunCountdown(countdownTime - 1, onFinished)));
            }
            else
            {
                animator.WithStartAction(new Runnable(onFinished));
                animator.WithEndAction(new Runnable(() => _label.Visibility = ViewStates.Visible));
            }
            animator.Start();
        }
示例#2
0
        public void SetupInitialAnimations(Action callback = null)
        {
            int delay        = 10;
            var time         = Resources.GetInteger(Android.Resource.Integer.ConfigMediumAnimTime);
            var delayIncr    = (3 * time) / 4;
            var interpolator = new Android.Views.Animations.DecelerateInterpolator();
            ViewPropertyAnimator circleAnim = null;

            foreach (var id in circleIds)
            {
                var circle = circlesLayout.FindViewById(id);

                circle.ScaleX = .3f;
                circle.ScaleY = .3f;
                circle.Alpha  = 0;

                circleAnim = circle.Animate()
                             .ScaleX(1)
                             .ScaleY(1)
                             .Alpha(1)
                             .SetStartDelay(delay)
                             .SetDuration(time)
                             .SetInterpolator(interpolator);

                var last = id == circleIds.Last();
                if (last && callback != null)
                {
                    circleAnim.WithEndAction(new Run(callback));
                }

                circleAnim.Start();
                delay += delayIncr;
            }
        }
 private void RunOnAnimationEnd(ViewPropertyAnimator animator, Action runnable)
 {
     if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
     {
         animator.WithEndAction(new Java.Lang.Runnable(runnable));
     }
     else
     {
         animator.SetListener(new Listener(runnable));
     }
 }