Exemple #1
0
        public static void CustomButtomLoadingAnimation(string animation, UIButton button, string viewText, bool shouldAnimate)
        {
            if (shouldAnimate)
            {
                _lottieAnimation             = LOTAnimationView.AnimationNamed(animation);
                _lottieAnimation.ContentMode = UIViewContentMode.ScaleAspectFit;
                _lottieAnimation.Frame       = button.Frame;
                button.AddSubview(_lottieAnimation);
                _lottieAnimation.LoopAnimation = true;

                button.SetTitle("", UIControlState.Normal);
                _lottieAnimation.AnimationProgress = 0;
                _lottieAnimation.Hidden            = false;
                _lottieAnimation.Play();
            }
            else
            {
                if (_lottieAnimation != null)
                {
                    _lottieAnimation.Hidden = true;
                    _lottieAnimation.Pause();
                    _lottieAnimation?.Dispose();
                    _lottieAnimation = null;
                }

                button.SetTitle(viewText, UIControlState.Normal);
            }
        }
Exemple #2
0
        private void LoadingAnimation(bool animate)
        {
            if (_lottieAnimation == null)
            {
                _lottieAnimation = LOTAnimationView.AnimationNamed("progress_refresh");
            }

            if (animate)
            {
                var size = ScreenWidth / 4 + 8;
                _lottieAnimation.Frame = new CGRect(size, _navBarView.Frame.Height - 2.7f, ScreenWidth - size * 2, 2.5f);
                _lottieAnimation.Layer.CornerRadius = 0.8f;
                _navBarView.AddSubview(_lottieAnimation);
                _lottieAnimation.LoopAnimation     = true;
                _lottieAnimation.ContentMode       = UIViewContentMode.Redraw;
                _lottieAnimation.Hidden            = false;
                _lottieAnimation.AnimationProgress = 0;
                _lottieAnimation.Play();
            }
            else
            {
                _lottieAnimation.Hidden = true;
                _lottieAnimation?.Pause();
            }
        }
Exemple #3
0
 public void StopLoading()
 {
     _lottieAnimation?.Pause();
     _lottieAnimation?.RemoveFromSuperview();
     _lottieAnimation?.Dispose();
     _lottieAnimation = null;
 }
Exemple #4
0
 public void Pause()
 {
     SetIsPlaying(false);
     _animation.Pause();
 }
Exemple #5
0
 public void Pause()
 {
     _animation.Pause();
     _isPlaying = false;
 }