Beispiel #1
0
        /// <summary>
        /// Hide the navigation bar
        /// </summary>
        /// <param name="animated">If set to <c>true</c> the scrolling is animated.</param>
        public void HideNavbar(bool animated)
        {
            if (scrollableView == null || VisibleViewController == null)
            {
                return;
            }

            if (State == NavigationBarState.Expanded)
            {
                State = NavigationBarState.Scrolling;
                UIView.AnimateNotify(animated ? 0.1 : 0, () => {
                    ScrollWithDelta(fullNavbarHeight);
                    VisibleViewController.View.SetNeedsLayout();
                    var scroll = scrollView;
                    if (NavigationBar.Translucent && scroll != null)
                    {
                        var currentOffset    = contentOffset;
                        scroll.ContentOffset = new CGPoint(currentOffset.X, currentOffset.Y + navbarHeight);
                    }
                }, completed => {
                    State = NavigationBarState.Collapsed;
                });
            }
            else
            {
                UpdateNavbarAlpha();
            }
        }
Beispiel #2
0
        private void CheckForPartialScroll()
        {
            var    frame    = NavigationBar.Frame;
            var    duration = 0.0;
            nfloat delta    = 0.0f;

            // Scroll back down
            if (NavigationBar.Frame.Y >= (statusBarHeight - (frame.Height / 2)))
            {
                delta    = frame.Y - statusBarHeight;
                duration = Math.Abs((delta / (frame.Height / 2)) * 0.2);
                State    = NavigationBarState.Expanded;
            }
            else
            {
                // Scroll up
                delta    = frame.Y + deltaLimit;
                duration = Math.Abs((delta / (frame.Height / 2)) * 0.2);
                State    = NavigationBarState.Collapsed;
            }
            UIView.AnimateNotify(duration, 0, UIViewAnimationOptions.BeginFromCurrentState, () => {
                UpdateSizing(delta);
                UpdateNavbarAlpha();
            }, null);
        }
        private RectangleF LeftMenuClose(PointF velocity, RectangleF frame)
        {
            float  distance          = 0;
            double animationDuration = 0;

            // Compute animation duration
            distance          = frame.X;
            animationDuration = Math.Abs(distance / velocity.X);

            if (animationDuration > ANIMATION_DURATION)
            {
                animationDuration = ANIMATION_DURATION;
            }

            // Remove gestures
            TapGesture.Enabled = false;
            PanGesture.Enabled = _panEnabledWhenSlideMenuIsHidden;

            frame.X = 0;

            if (!leftMenuWasOpenAtPanBegin)
            {
                leftMenuViewController.EndAppearanceTransition();
            }

            leftMenuViewController.BeginAppearanceTransition(false, true);

            UIView.AnimateNotify(animationDuration, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                contentViewController.View.Frame = frame;
            }, (finished) => {
                leftMenuViewController.EndAppearanceTransition();
            });

            return(frame);
        }
Beispiel #4
0
                public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
                {
                    var container = transitionContext.ContainerView;
                    var @to       = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);

                    @to.View.Frame = UIScreen.MainScreen.Bounds;
                    @to.View.Alpha = 0;

                    var backgroundColor = Theme.ColorPalette.Background.ToUIColor();

                    var brightness = ((backgroundColor.CGColor.Components[0] * 299) + (backgroundColor.CGColor.Components[1] * 587) + (backgroundColor.CGColor.Components[2] * 114)) / 1000;

                    var visualEffectView = new UIVisualEffectView(UIBlurEffect.FromStyle(brightness > 0.5f ? UIBlurEffectStyle.ExtraLight : UIBlurEffectStyle.ExtraDark))
                    {
                        Frame = UIScreen.MainScreen.Bounds,
                        Tag   = VISUAL_EFFECT_TAG,
                        Alpha = 0
                    };

                    container.AddSubviews(
                        visualEffectView,
                        @to.View
                        );

                    UIView.AnimateNotify(ANIMATION_DURATION, 0.0, UIViewAnimationOptions.CurveEaseIn, () =>
                    {
                        visualEffectView.Alpha = 1f;
                        @to.View.Alpha         = 1f;
                    }, finished =>
                    {
                        transitionContext.CompleteTransition(true);
                    });
                }
        public void ShowRightMenuAnimated(bool animated, UICompletionHandler completion)
        {
            if (rightMenuViewController == null)
            {
                return;
            }

            isOpeningRightMenu = true;

            var duration = animated ? ANIMATION_DURATION : 0;

            UIView     contentView      = contentViewController.View;
            RectangleF contentViewFrame = contentView.Frame;

            contentViewFrame.X = OffsetXWhenMenuIsOpen();

            LoadRightMenuViewControllerViewIfNeeded();
            rightMenuViewController.BeginAppearanceTransition(true, true);

            UIView.AnimateNotify(duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                contentView.Frame = contentViewFrame;
            }, (finished) => {
                rightMenuViewController.EndAppearanceTransition();

                TapGesture.Enabled = true;
                PanGesture.Enabled = true;

                if (completion != null)
                {
                    completion(finished);
                }

                isOpeningRightMenu = false;
            });
        }
Beispiel #6
0
        public void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
        {
            var fromController = transitionContext.GetViewControllerForKey(
                UITransitionContext.FromViewControllerKey);
            var toController = transitionContext.GetViewControllerForKey(
                UITransitionContext.ToViewControllerKey);

            if (fromController is PestoDetailViewController &
                toController is PestoViewController)
            {
                CGRect detailFrame = fromController.View.Frame;
                detailFrame.Y = this.View.Frame.Size.Height;


                UIView.AnimateNotify(TransitionDuration(transitionContext),
                                     0.5f,
                                     UIViewAnimationOptions.CurveEaseIn,
                                     () => {
                    fromController.View.Frame = detailFrame;
                }, new UICompletionHandler((bool finished) => {
                    if (fromController.View != null)
                    {
                        fromController.View.RemoveFromSuperview();
                    }
                    transitionContext.CompleteTransition(true);
                }));
            }
        }
        public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
        {
            var fromViewController = transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey);
            var toViewController   = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);

            var screenBounds = UIScreen.MainScreen.Bounds;
            var fromFrame    = fromViewController.View.Frame;

            UIView.AnimateNotify(_transitionDuration,
                                 () =>
            {
                toViewController.View.Alpha = 1.0f;

                switch (fromViewController.InterfaceOrientation)
                {
                case UIInterfaceOrientation.Portrait:
                    fromViewController.View.Frame = new RectangleF(0, screenBounds.Height, fromFrame.Width, fromFrame.Height);
                    break;

                case UIInterfaceOrientation.LandscapeLeft:
                    fromViewController.View.Frame = new RectangleF(screenBounds.Width, 0, fromFrame.Width, fromFrame.Height);
                    break;

                case UIInterfaceOrientation.LandscapeRight:
                    fromViewController.View.Frame = new RectangleF(screenBounds.Width * -1, 0, fromFrame.Width, fromFrame.Height);
                    break;

                default:
                    break;
                }
            },
                                 (finished) => transitionContext.CompleteTransition(true));
        }
Beispiel #8
0
        public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
        {
            var containerView = transitionContext.ContainerView;

            var toViewController   = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);
            var fromViewController = transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey);

            containerView.AddSubview(toViewController.View);
            toViewController.View.Frame = CGRect.Empty;

            var startPoint = GetStartPoint(fromViewController.InterfaceOrientation);

            if (fromViewController.InterfaceOrientation == UIInterfaceOrientation.Portrait)
            {
                toViewController.View.Frame = new CGRect(startPoint.X, startPoint.Y, fromViewController.View.Frame.Width, fromViewController.View.Frame.Height);
            }
            else
            {
                toViewController.View.Frame = new CGRect(startPoint.X, startPoint.Y, fromViewController.View.Frame.Height, fromViewController.View.Frame.Width);
            }

            UIView.AnimateNotify(Duration, delegate {
                toViewController.View.Frame   = new CGRect(0, 0, fromViewController.View.Frame.Width, fromViewController.View.Frame.Height);
                fromViewController.View.Alpha = 0.5f;
            }, delegate {
                transitionContext.CompleteTransition(true);
            });
        }
    /// <summary>
    ///     Slides a view vertically out of focus.
    /// </summary>
    /// <param name="direction">The direction to slide the view in via. Top (positive) or bottom (negative).</param>
    /// <param name="animDuration">The duration of the animation.</param>
    /// <param name="delay">The delay before the animation starts.</param>
    /// <param name="finishedAction">The action invoked upon animation completion.</param>
    public static void SlideOutVertically(this UIView view, int direction, float animDuration, float delay = 0, Action finishedAction = null)
    {
        view.Transform = CGAffineTransform.MakeIdentity();

        UIView.AnimateNotify(animDuration, delay, UIViewAnimationOptions.CurveEaseInOut, () =>
        {
            nfloat ty;

            if (direction > 0)
            {
                ty = 0 - view.Frame.Height;
            }

            else
            {
                ty = MessagingServiceCore.Window.Bounds.Height - view.Frame.Y;
            }

            view.Transform = CGAffineTransform.MakeTranslation(0, ty);
        }, (hasFinished) =>
        {
            if (hasFinished)
            {
                finishedAction?.Invoke();
            }
        });
    }
Beispiel #10
0
 /// <summary>
 /// This method changes the state of the switch, and will animate the change if specified.
 /// </summary>
 /// <param name="newState">The new value of the switch.</param>
 /// <param name="animated">If the change in state should be animated.</param>
 public virtual void SetState(bool newState, bool animated)
 {
     on = newState;
     if (animated)
     {
         UIView.AnimateNotify(
             AnimationDuration,
             0.0,
             AnimationSpringDamping,
             AnimationInitialSpringVelocity,
             UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseOut,
             () => LayoutSubviews(),
             finished =>
         {
             if (finished)
             {
                 SendActionForControlEvents(UIControlEvent.ValueChanged);
             }
         });
     }
     else
     {
         LayoutSubviews();
         SendActionForControlEvents(UIControlEvent.ValueChanged);
     }
 }
Beispiel #11
0
        /// <summary>
        /// Shows the menu from controller.
        /// </summary>
        /// <param name="viewController">View controller.</param>
        public void ShowMenuFromController(UIViewController viewController)
        {
            if (this.DoneAnimations)
            {
                return;
            }

            this.NavController = JVMenuHelper.TopViewController();

            this.CurrentController = viewController;

            var currFrame = MenuView.Frame;

            var newFrame = this.View.Frame;

            UIView.AnimateNotify(0.15f, () =>
            {
                if (this.NavController != this.CurrentController)
                {
                    this.CurrentController.View.Transform = CGAffineTransform.Scale(CGAffineTransform.MakeIdentity(), 0.6f, 0.6f);
                }
            }, (bool finished) =>
            {
                if (finished)
                {
                    this.Image = JVMenuHelper.TakeScreenShotOfView(this.NavController.View, false);

                    this.View.BackgroundColor = UIColor.FromPatternImage(this.Image);

                    if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                    {
                        if (!UIAccessibility.IsReduceTransparencyEnabled)
                        {
                            //VibrancyEffectView.ContentView.Add(MenuView);
                            //VibrancyEffectView.ContentView.Add(CloseBtn);
                            //BlurEffectView.ContentView.Add(VibrancyEffectView);

                            this.View.InsertSubview(BlurEffectView, 0);
                        }
                    }

                    this.DoneAnimations = true;
                    this.CloseBtn.Alpha = 0.0f;
                    this.MenuView.Alpha = 0.0f;

                    this.NavController.PresentViewController(this, false, () =>
                    {
                        UIView.Animate(0.15f, 0.0f, UIViewAnimationOptions.CurveEaseInOut, () =>
                        {
                            this.CloseBtn.Alpha = 1.0f;
                            this.MenuView.Alpha = 1.0f;

                            this.MenuView.TableView.ReloadData();
                        }, null);
                    });
                }
            });

            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);
        }
        /// <summary>
        /// Helper function to manipulate RootViewController's frame with animation
        /// </summary>
        private void SetRootViewFrame(CGRect frame)
        {
            var controller = _textFieldView.GetTopMostController();

            if (controller == null)
            {
                controller = GetKeyWindow().GetTopMostController();
            }

            if (controller != null)
            {
                var newFrame = frame;

                newFrame.Size = controller.View.Frame.Size;

                UIView.AnimateNotify(_animationDuration, 0.0, UIViewAnimationOptions.BeginFromCurrentState | _animationCurve, () =>
                {
                    controller.View.Frame = newFrame;

                    if (LayoutIfNeededOnUpdate)
                    {
                        controller.View.SetNeedsLayout();
                        controller.View.LayoutIfNeeded();
                    }
                }, null);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("You must set UIWindow.rootViewController in your AppDelegate to work with IQKeyboardManager");
            }
        }
        private RectangleF LeftMenuOpen(PointF velocity, RectangleF frame, float offsetXWhenMenuIsOpen)
        {
            float  distance          = 0;
            double animationDuration = 0;

            distance          = Math.Abs(offsetXWhenMenuIsOpen - frame.X);
            animationDuration = Math.Abs(distance / velocity.X);
            if (animationDuration > ANIMATION_DURATION)
            {
                animationDuration = ANIMATION_DURATION;
            }

            frame.X = offsetXWhenMenuIsOpen;
            UIView.AnimateNotify(animationDuration, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                contentViewController.View.Frame = frame;
            }, (finished) => {
                TapGesture.Enabled = true;

                if (!leftMenuWasOpenAtPanBegin && leftMenuViewController != null)
                {
                    leftMenuViewController.EndAppearanceTransition();
                }
            });

            return(frame);
        }
Beispiel #14
0
        public override void Perform()
        {
            tmpWidth  = this.SourceViewController.View.Frame.Size.Width;
            tmpHeight = this.SourceViewController.View.Frame.Size.Height;

            // Setup Action Delegates
            _slider            = new Action(animateSlide);
            _animationcomplete = new UICompletionHandler(animateComplete);

            this.SourceViewController.View.InsertSubview(this.DestinationViewController.View, 0);
            this.SourceViewController.View.BringSubviewToFront(this.SourceViewController.View.Subviews[0]);
            DestinationViewController.View.Transform = CGAffineTransform.MakeScale(0.05f, 0.05f);


            CGPoint originalCenter = this.DestinationViewController.View.Center;

            DestinationViewController.View.Center = this.SourceViewController.View.Center;

            #if DEBUG
            //this.SourceViewController.View.Center = this.upFull;
            #endif

            UIView.AnimateNotify(

                kAnimationDuration,
                _slider,
                _animationcomplete
                );

            // Most important to setup the new VC...
            this.SourceViewController.PresentViewController(this.DestinationViewController, false, null);
            UIApplication.SharedApplication.KeyWindow.RootViewController = this.DestinationViewController;
        }
Beispiel #15
0
        void AnimateView(bool up)
        {
            UIView.AnimateNotify(up ? _ExtendedButton.LongPressDuration : 0.5, 0, UIViewAnimationOptions.BeginFromCurrentState, delegate()
            {
                _longPressAnimationEnded = false;

                if (up)
                {
                    _fillView.Frame = Control.Frame;
                }
                else
                {
                    _fillView.Frame = GetResetFillFrame();
                    Control.LayoutSubviews();
                }
            }, (finished) =>
            {
                if (up)
                {
                    _longPressAnimationEnded = true;
                }
                else
                {
                    _longPressAnimationEnded = false;
                }
            });
        }
Beispiel #16
0
 async void DisplaySearchResults()
 {
     try {
         Task <string> getSearchJson = Utilities.GetSearchJson("downloadable", DownloadsNavSearchBar.Text);
         var           searchItems   = JsonConvert.DeserializeObject <List <Game> >(await getSearchJson);
         parsedDownloadsJson = new Dictionary <string, List <Game> >();
         parsedDownloadsJson.Add("Found " + searchItems.Count() + " Result(s)", searchItems);
         TableView.Source = new DownloadableTableSource(parsedDownloadsJson);
         TableView.Hidden = false;
         if (IsViewLoaded && View.Window != null && DownloadsNavSearchBar.Alpha.Equals(1))
         {
             TableView.ReloadData();
             UIView.AnimateNotify(0.4, 0, 0.65f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
                 DownloadsNavCloseBtn.Transform             = Utilities.Show;
                 DownloadsNavSearchLoadingSpinner.Transform = Utilities.Hide;
                 TableView.Alpha = 1;
             }, delegate { DownloadsNavSearchLoadingSpinner.StopAnimating(); });
         }
     }
     catch {
         UIAlertView alert = new UIAlertView("Error", "Problem connecting.\n" +
                                             "Please check your connection and try again.", null, "OK", null);
         alert.Show();
         DownloadsNavCloseBtn.Transform = Utilities.Show;
         DownloadsNavSearchLoadingSpinner.StopAnimating();
     }
 }
Beispiel #17
0
        private void SetLoginBtnEvent()
        {
            LoginBtn.TouchUpInside += (sender, args) =>
            {
                if (_oldButtonCenters == null)
                {
                    _oldButtonCenters = new[] { FacebookBtn.Center, GoogleBtn.Center, MicrosoftBtn.Center };
                }

                UIView.AnimateNotify(1, 0, 0.6f, 0f, UIViewAnimationOptions.CurveEaseOut, () =>
                {
                    FacebookBtn.Alpha  = 1;
                    GoogleBtn.Alpha    = 1;
                    MicrosoftBtn.Alpha = 1;
                    LoginTitle.Alpha   = 0;
                    LoginDesc.Alpha    = 0;
                    LoginBtn.Alpha     = 0;


                    FacebookBtn.Center = new CGPoint(View.Bounds.Left + FacebookBtn.Bounds.Width / 2 + 20,
                                                     View.Center.Y);
                    GoogleBtn.Center    = new CGPoint(View.Center.X, View.Center.Y);
                    MicrosoftBtn.Center = new CGPoint(View.Bounds.Right - MicrosoftBtn.Bounds.Width / 2 - 20,
                                                      View.Center.Y);
                }, null);

                _wasAnimated = true;
            };
        }
Beispiel #18
0
        void UpdateUI()
        {
            Console.WriteLine($"ViewController Updating UI");

            UIView.AnimateNotify(0.4d, 0.0d, UIViewAnimationOptions.CurveEaseInOut, () =>
            {
                _leftStatus.Text  = _garageViewModel.LeftGarageStatus;
                _rightStatus.Text = _garageViewModel.RightGarageStatus;

                _leftButton.Enabled = _garageViewModel.IsConnected &&
                                      _garageViewModel.Garages?.LeftGarage?.Status != GarageStatus.Unknown;

                _rightButton.Enabled = _garageViewModel.IsConnected &&
                                       _garageViewModel.Garages?.RightGarage?.Status != GarageStatus.Unknown;

                _leftButton.BackgroundColor = _garageViewModel.IsConnected && _garageViewModel.Garages?.LeftGarage?.Status == GarageStatus.Open
                                        ? UIColor.FromRGB(57, 191, 64)
                                        : _garageViewModel.IsConnected && _garageViewModel.Garages?.LeftGarage?.Status == GarageStatus.Closed
                                        ? UIColor.FromRGB(65, 217, 73)
                                        : UIColor.FromRGB(211, 218, 212);
                _rightButton.BackgroundColor = _garageViewModel.IsConnected && _garageViewModel.Garages?.RightGarage?.Status == GarageStatus.Open
                                        ? UIColor.FromRGB(196, 167, 0)
                                        : _garageViewModel.IsConnected && _garageViewModel.Garages?.RightGarage?.Status == GarageStatus.Closed
                                        ? UIColor.FromRGB(247, 210, 0)
                                        : UIColor.FromRGB(211, 218, 212);

                _connectionStatus.Text      = _garageViewModel.Status;
                _connectionStatus.TextColor = _garageViewModel.IsConnected ? UIColor.FromRGB(65, 217, 73) : UIColor.Black;
            }, (finished) => { });
        }
Beispiel #19
0
        public void NavigateToUnsafe(Page page, object parameter)
        {
            System.Diagnostics.Debug.WriteLine($"Navigate to  {page.ToString()} in thread {Thread.CurrentThread.ManagedThreadId.ToString()}");

            lock (pagesByKey)
            {
                Type type;
                if (pagesByKey.ContainsKey(page))
                {
                    type = pagesByKey[page].Type;
                }
                else
                {
                    throw new InvalidOperationException($"Unable to navigate: page {page.ToString()} not found");
                }

                if (!CrossConnectivity.Current.IsConnected)
                {
                    var dialogService = ServiceLocator.Current.GetInstance <IDialogService>();
                    dialogService.ShowMessage(LocalizedStrings.ConnectionError, LocalizedStrings.Error);
                    return;
                }

                if (pagesByKey[page].RequireAuth)
                {
                    var accountManager = ServiceLocator.Current.GetInstance <IAccountManager>();
                    if (!accountManager.IsAuthorized())
                    {
                        NavigateTo(Page.SignInPage);
                        return;
                    }
                }

                UIViewController uIViewController;

                uIViewController = CreateController(page, parameter);

                if (pagesByKey[page].IsRoot)
                {
                    UIView snapShot = AppDelegate.Instance.Window.SnapshotView(false);
                    AppDelegate.Instance.Window.RootViewController = new TransparentNavigationController(uIViewController);

                    if (snapShot != null)
                    {
                        uIViewController.View.AddSubview(snapShot);

                        UIView.AnimateNotify(0.3f, () =>
                        {
                            snapShot.Layer.Opacity   = 0;
                            snapShot.Layer.Transform = CATransform3D.MakeScale(1.5f, 1.5f, 1.5f);
                        }, (finished) => snapShot.RemoveFromSuperview());
                    }
                }
                else if (NavigationController.TopViewController == null || !NavigationController.Contains(uIViewController))
                {
                    this.NavigationController.PushViewController(uIViewController, true);
                }
            }
        }
Beispiel #20
0
        public override void Perform()
        {
            // Tag the destination with a local tag variable
            this.tmpTag = this.DestinationViewController.View.Tag;
            //this.DestinationViewController.View.Frame = this.iOSGlobals.G__RectWindowLandscape;

            // Landscape only segue
            tmpWidth  = this.iOSGlobals.G__RectWindowLandscape.Size.Width;
            tmpHeight = this.iOSGlobals.G__RectWindowLandscape.Size.Height;

            //Check the bounds, if they arent landscape, we have a LARGE problem...quit.
            if (this.SourceViewController.View.Bounds.Width == tmpHeight)
            {
                throw new System.ArgumentOutOfRangeException(this.SourceViewController.View.ToString(), "Bounds must be landscape");
            }

            //Check the SOURCE VIEW Frame orientation
            // If the frame is Portait (can happen due to rotation message delays?)
            // swap the Point sources
            if (this.SourceViewController.View.Frame.Width == tmpWidth)
            {
                leftFull = new CGPoint(((tmpWidth / 2) * -1), (tmpHeight / 2));
            }
            else
            {
                leftFull = new CGPoint((tmpHeight / 2), ((tmpWidth / 2) * -1));
            }

            this.SourceViewController.View.AddSubview(this.DestinationViewController.View);

            // If the frame is Portait (can happen due to rotation message delays?)
            // swap the Point sources - technically it should always be landscape after the preceding method...?
            if (this.SourceViewController.View.ViewWithTag(this.tmpTag).Frame.Width == tmpWidth)
            {
                rightFull = new CGPoint((tmpWidth + (tmpWidth / 2)), (tmpHeight / 2));
            }
            else
            {
                rightFull = new CGPoint((tmpHeight / 2), (tmpWidth + (tmpWidth / 2)));
            }


            // Put the destination view fully over to the right, off screen
            // Make sure the destinationview bounds are correct landscape
            this.SourceViewController.View.ViewWithTag(this.tmpTag).Center = this.leftFull;

            // Setup Action Delegates
            _slider            = new Action(animateSlide);
            _animationcomplete = new UICompletionHandler(animateComplete);


            UIView.AnimateNotify(
                kAnimationDuration,
                0,
                UIViewAnimationOptions.TransitionNone,
                _slider,
                _animationcomplete
                );
        }
        /// <summary>
        /// Touchs up animation.
        /// </summary>
        public void TouchUpAnimation()
        {
            foreach (UIImageView Icon in IconArray)
            {
                UIView.AnimateNotify(0.1f, 0.0f, UIViewAnimationOptions.BeginFromCurrentState, () =>
                {
                    Icon.Alpha = 0.0f;
                }
                                     , (finished) =>
                {
                    Icon.Hidden = true;
                });
            }

            var ButtonScaleSmallCABasicAnimation = CABasicAnimation.FromKeyPath(@"transform.scale");

            ButtonScaleSmallCABasicAnimation.Duration            = 0.2f;
            ButtonScaleSmallCABasicAnimation.AutoReverses        = false;
            ButtonScaleSmallCABasicAnimation.To                  = NSNumber.FromFloat(1.0f);
            ButtonScaleSmallCABasicAnimation.From                = NSNumber.FromFloat(BigRadius / SmallRadius);
            ButtonScaleSmallCABasicAnimation.FillMode            = CAFillMode.Forwards;
            ButtonScaleSmallCABasicAnimation.RemovedOnCompletion = false;

            SmallButton.Layer.AddAnimation(ButtonScaleSmallCABasicAnimation, @"ButtonScaleSmallCABasicAnimation");


            var BackgroundViewScaleSmallCABasicAnimation = CABasicAnimation.FromKeyPath(@"transform.scale");

            BackgroundViewScaleSmallCABasicAnimation.Duration            = 0.1f;
            BackgroundViewScaleSmallCABasicAnimation.AutoReverses        = false;
            BackgroundViewScaleSmallCABasicAnimation.To                  = NSNumber.FromFloat(1.0f);
            BackgroundViewScaleSmallCABasicAnimation.From                = NSNumber.FromNFloat(this.Frame.Size.Height / SmallRadius);
            BackgroundViewScaleSmallCABasicAnimation.FillMode            = CAFillMode.Forwards;
            BackgroundViewScaleSmallCABasicAnimation.RemovedOnCompletion = false;


            BackgroundView.Layer.AddAnimation(BackgroundViewScaleSmallCABasicAnimation, @"BackgroundViewScaleSmallCABasicAnimation");

            var Rotate = CATransform3D.MakeRotation(0, 0, 1, 0).Concat(CATransform3D.MakeRotation(0, 1, 0, 0));

            if (Parallex)
            {
                SmallButton.Layer.Transform = CATransform3DPerspect(Rotate, new CGPoint(0, 0), BigRadius + ParallexParameter);
            }
            else
            {
                //Do nothing ^_^
            }

            SmallButton.SetImage(IconImage, UIControlState.Normal);

            UIView.AnimateNotify(0.1f, 0.0f, UIViewAnimationOptions.BeginFromCurrentState, () =>
            {
                SmallButton.ImageView.Alpha = 1.0f;
            }
                                 , (finished) =>
            {
            });
        }
Beispiel #22
0
        void EndRotation(UIView view, double animationDuration)
        {
            var rotation = CGAffineTransform.MakeRotation(0);
            var scale    = CGAffineTransform.MakeScale(1f, 1f);

            InvokeOnMainThread(() =>
                               UIView.AnimateNotify(animationDuration, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseOut, () => { view.Transform = rotation; view.Transform = scale; }, null));
        }
 void hidePIPWindow()
 {
     UIView.AnimateNotify(0.3f, () => pipWindow.Alpha = 0, delegate(bool _)
     {
         pipWindow.Hidden = true;
         pipWindow        = null;
     });
 }
 private static void AnimateNotifyInternal(double duration, Action animation, Action <bool> onCompletion)
 {
     AppTools.InvokeOnMainThread(() =>
     {
         UIView.AnimateNotify(duration, 0, UIViewAnimationOptions.CurveEaseInOut, animation,
                              finished => { onCompletion?.Invoke(finished); });
     });
 }
        public void CloseDrawer()
        {
            var drawerRect = drawerContainerView.Frame;

            drawerRect.Height -= 132;

            UIView.AnimateNotify(1, () => drawerContainerView.Frame = drawerRect, (finished) => drawerContainerView.RemoveFromSuperview());
        }
Beispiel #26
0
        void StartRotation(UIView view, nfloat rotationOffsetDegrees, double animationDuration)
        {
            nfloat degreesToRadiansConversion = (nfloat)Math.PI / 180;
            var    rotation = CGAffineTransform.MakeRotation(degreesToRadiansConversion * rotationOffsetDegrees);
            var    scale    = CGAffineTransform.MakeScale(1.05f, 1.05f);

            InvokeOnMainThread(() =>
                               UIView.AnimateNotify(animationDuration, 0, UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat | UIViewAnimationOptions.AllowUserInteraction, () => { view.Transform = rotation; view.Transform = scale; }, null));
        }
Beispiel #27
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     UIView.AnimateNotify(0.4d, 0.0d, UIViewAnimationOptions.CurveEaseInOut, () =>
     {
         _connectionStatus.Layer.Opacity = 1f;
         _buttonStack.Layer.Opacity      = 1f;
     }, (finished) => { });
 }
Beispiel #28
0
        void AnimateWithSpring()
        {
            float springDampingRatio    = 0.25f;
            float initialSpringVelocity = 1.0f;

            UIView.AnimateNotify(3.0, 0.0, springDampingRatio, initialSpringVelocity, 0, () => {
                imageView.Center = new CGPoint(imageView.Center.X, 400);
            }, null);
        }
 void dismissPreview()
 {
     UIView.AnimateNotify(0.7f, 0.0f, 0.8f, 1.0f, UIViewAnimationOptions.AllowUserInteraction, () => {
         if (dismissTap != null)
         {
             dismissTap.View.RemoveFromSuperview();
         }
     }, (finished) => { });
 }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            UIView.AnimateNotify(0.4f, 0.0f, 0.9f, 0.1f, UIViewAnimationOptions.CurveEaseInOut, () =>
            {
                ButtonStackView.Transform = CGAffineTransform.MakeIdentity();
            }, (finished) => { });
        }