private UIView GetIndicatorView(string loadingStatus) { var container = GetCurrentMainLoadingContainer(); container.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 50); var spinnerContentView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; spinnerContentView.BackgroundColor = UIColor.White; spinnerContentView.Layer.CornerRadius = 10; AddSpinnerContentViewToParentWithConstraints(container, spinnerContentView); _animationView = LOTAnimationView.AnimationNamed("loader.json"); _animationView.TranslatesAutoresizingMaskIntoConstraints = false; _animationView.LoopAnimation = true; spinnerContentView.ClipsToBounds = true; _label = new UILabel { Text = loadingStatus, TextColor = UIColor.FromRGB(57, 57, 57), TextAlignment = UITextAlignment.Center, Lines = 0, TranslatesAutoresizingMaskIntoConstraints = false, }; _label.SizeToFit(); AddLoaderToParentWithConstraints(spinnerContentView, _animationView, _label); _animationView.Play(); return(container); }
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(); } }
async void load(int idx) { foreach (var view in this.Container.Subviews) { view.RemoveFromSuperview(); } var url = ""; switch (idx) { case 0: url = "https://www.lottiefiles.com/storage/datafiles/jW5K6vtuzJFJSxd/data.json"; break; case 1: url = "https://www.lottiefiles.com/storage/datafiles/30e6f85b10d28931e85c2e0fcffa2f59/data.json"; break; case 2: default: url = "https://www.lottiefiles.com/storage/datafiles/8UjWgBkqvEF5jNoFcXV4sdJ6PXpS6DwF7cK4tzpi/Check%20Mark%20Success/Check%20Mark%20Success%20Data.json"; break; } LOTAnimationView animation = new LOTAnimationView(new Foundation.NSUrl(url)); animation.ContentMode = UIViewContentMode.ScaleAspectFit | UIViewContentMode.Center; animation.Frame = new CoreGraphics.CGRect(this.Container.Frame.X, this.Container.Frame.Y, this.Container.Frame.Width, this.Container.Frame.Height); this.Container.AddSubview(animation); this.Container.SetNeedsLayout(); animation.Play(); }
private void CommonInit() { ContentView = ViewFromNib(); NoDataLabel.Text = Localize.GetText("State.NoDate"); ContentView.Frame = Frame; ContentView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight & UIViewAutoresizing.FlexibleWidth; AutoresizingMask = UIViewAutoresizing.FlexibleHeight & UIViewAutoresizing.FlexibleWidth; AddSubview(ContentView); TranslatesAutoresizingMaskIntoConstraints = false; ContentView.TranslatesAutoresizingMaskIntoConstraints = false; ContentView.LeadingAnchor.ConstraintEqualTo(LeadingAnchor).Active = true; ContentView.TrailingAnchor.ConstraintEqualTo(TrailingAnchor).Active = true; ContentView.BottomAnchor.ConstraintEqualTo(BottomAnchor).Active = true; ContentView.TopAnchor.ConstraintEqualTo(TopAnchor).Active = true; LOTAnimationView lottie = LOTAnimationView.AnimationNamed("no-data"); lottie.ContentMode = UIViewContentMode.ScaleAspectFit; LottieView.Frame = new CGRect(LottieView.Frame.X, LottieView.Frame.Y, Frame.Width, Frame.Width); lottie.Frame = LottieView.Frame; LottieView.AddSubview(lottie); lottie.SetFillXContraintTo(LottieView, 16); lottie.SetFillYContraintTo(LottieView, 16); lottie.SetBottomContraintTo(LottieView, 0, NSLayoutRelation.GreaterThanOrEqual); AddConstraint(NSLayoutConstraint.Create(lottie, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0)); lottie.Play(); }
private void CommonInit() { ContentView = ViewFromNib(); ContentView.Frame = Frame; NoInternetLabel.Text = Localize.GetText("State.NoInternet.Message"); UpdateButton.TouchUpInside += (sender, e) => { RefreshCommand.Execute(); }; AddSubview(ContentView); ContentView.LeadingAnchor.ConstraintEqualTo(LeadingAnchor).Active = true; ContentView.TrailingAnchor.ConstraintEqualTo(TrailingAnchor).Active = true; ContentView.BottomAnchor.ConstraintEqualTo(BottomAnchor).Active = true; ContentView.TopAnchor.ConstraintEqualTo(TopAnchor).Active = true; LOTAnimationView lottie = LOTAnimationView.AnimationNamed("no-internet-connection"); lottie.ContentMode = UIViewContentMode.ScaleAspectFit; LottieView.Frame = new CGRect(LottieView.Frame.X, LottieView.Frame.Y, Frame.Width, Frame.Width); LottieView.AddSubview(lottie); lottie.Frame = LottieView.Bounds; lottie.SetFillXContraintTo(LottieView); lottie.LoopAnimation = true; lottie.Play(); }
public static void LoadingInView(string animationName, UIView view, bool shouldAnimate) { if (shouldAnimate) { view.Hidden = false; _lottieAnimation = LOTAnimationView.AnimationNamed(animationName); _lottieAnimation.Frame = new CGRect(0, 0, view.Frame.Width, view.Frame.Height); view.AddSubview(_lottieAnimation); _lottieAnimation.LoopAnimation = true; _lottieAnimation.Hidden = false; _lottieAnimation.AnimationProgress = 0; _lottieAnimation.Play(); } else { view.Hidden = true; if (_lottieAnimation != null) { _lottieAnimation.Hidden = true; _lottieAnimation.Pause(); _lottieAnimation?.Dispose(); _lottieAnimation = null; } } }
public static void LoadingInChat(UIView view, bool shouldAnimate) { if (shouldAnimate) { _lottieAnimation = LOTAnimationView.AnimationNamed("progress_refresh"); var size = _mainViewSize / 4 + 8; _lottieAnimation.Frame = new CGRect(size, view.Frame.Height - 2.7f, _mainViewSize - size * 2, 2.5f); _lottieAnimation.Layer.CornerRadius = 0.8f; view.AddSubview(_lottieAnimation); _lottieAnimation.LoopAnimation = true; _lottieAnimation.ContentMode = UIViewContentMode.Redraw; _lottieAnimation.Hidden = false; _lottieAnimation.AnimationProgress = 0; _lottieAnimation.Play(); } else { if (_lottieAnimation != null) { _lottieAnimation.Hidden = true; _lottieAnimation.Pause(); _lottieAnimation?.Dispose(); _lottieAnimation = null; } } }
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); } }
public override void ViewDidLoad() { base.ViewDidLoad(); LOTAnimationView animation = LOTAnimationView.AnimationNamed("heart"); View.AddSubview(animation); animation.Play(); }
public LoadingOverlay(CGRect frame, string text = "") : base(frame) { BackgroundColor = UIColor.FromWhiteAlpha(0, 0.2f); _animation = LOTAnimationView.AnimationNamed("Animations/preloader"); _animation.ContentMode = UIViewContentMode.ScaleAspectFit; _animation.Frame = frame; _animation.LoopAnimation = true; _animation.Play(); Alpha = 0.75f; Add(_animation); Frame = frame; AutoresizingMask = UIViewAutoresizing.All; //nfloat labelHeight = 22; //nfloat labelWidth = Frame.Width - 20; //// derive the center x and y //nfloat centerX = Frame.Width / 2; //nfloat centerY = Frame.Height / 2; // create the activity spinner, center it horizontall and put it 5 points above center x //activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); //activitySpinner.Color = ConstantsiOS.GeneralRedColor; //activitySpinner.Frame = new CGRect( // centerX - (activitySpinner.Frame.Width / 2), // centerY - activitySpinner.Frame.Height - 20, // activitySpinner.Frame.Width, // activitySpinner.Frame.Height); //activitySpinner.AutoresizingMask = UIViewAutoresizing.All; //AddSubview(activitySpinner); //activitySpinner.StartAnimating(); //// create and configure the "Loading Data" label //loadingLabel = new UILabel(new CGRect( // centerX - (labelWidth / 2), // centerY + 20, // labelWidth, // labelHeight // )); //loadingLabel.BackgroundColor = UIColor.Clear; ////loadingLabel.TextColor = ConstantsiOS.LabelDarkGrayColor; //if (!string.IsNullOrEmpty(text)) // loadingLabel.Text = text; //else //{ // loadingLabel.Text = "Loading"; //TranslationExtension.LanguageBundle.LocalizedString("Mobile_Loading", ""); //} //loadingLabel.TextAlignment = UITextAlignment.Center; //loadingLabel.AutoresizingMask = UIViewAutoresizing.All; //AddSubview(loadingLabel); }
public void UpdateCell(string title, string subtitle, bool shouldShowLottie) { FontUtil.ApplyFontAttribute(this); this.TitleLabel.Text = title; this.SubtitleLabel.Text = subtitle; if (shouldShowLottie) { LOTAnimationView animation = LOTAnimationView.AnimationNamed("RightArrow"); animation.Frame = this.ImageView.Bounds; animation.LoopAnimation = true; this.ImageView.AddSubview(animation); animation.Play(); } }
public void StartLoading(LoadingColor color) { StopLoading(); _lottieAnimation = color == LoadingColor.Blue ? LOTAnimationView.AnimationNamed("load_blue") : LOTAnimationView.AnimationNamed("load_white"); _lottieAnimation.ContentMode = UIViewContentMode.ScaleAspectFit; if (_view == null) { _view = ((AppDelegate)UIApplication.SharedApplication.Delegate).Window; } _lottieAnimation.Frame = new CGRect(0, 0, 90, 90); _lottieAnimation.Center = _view.Center; _view.AddSubview(_lottieAnimation); _lottieAnimation.LoopAnimation = true; _lottieAnimation.Play(); }
public void Resume() { _animation.Play(); SetIsPlaying(true); }
private void AppMovedForeground(object sender, NSNotificationEventArgs args) { _animationView?.Play(); }
public void Play(bool looped) { _isPlaying = true; _animation.LoopAnimation = looped; _animation.Play(); }
public void Play() { _loadingAnimationView?.Play(); }