Наследование: MonoBehaviour
        /// <summary>
        /// Handles view animations when the keyboard is shown.
        /// </summary>
        /// <param name="e">The keyboard arguments for the event.</param>
        public override void AnimateOnShown(UIKeyboardEventArgs e)
        {
            bool shouldHideTopSection;
            int  translateY = this.CalculateVerticalTranslation(e.Notification, out shouldHideTopSection);

            if (translateY < 0)
            {
                Action topSectionAnimation;

                if (shouldHideTopSection)
                {
                    topSectionAnimation = () => this.topSection.Hide();
                }
                else
                {
                    topSectionAnimation = () => ViewAnimation.AnimateMoveVertical(e.AnimationDuration, translateY, this.topSection.Views);
                }

                ViewAnimation.AnimateMoveVertical(
                    e.AnimationDuration,
                    translateY,
                    topSectionAnimation,
                    this.bottomSection.Views);

                shouldAnimateOnHide = true;
            }
            else
            {
                shouldAnimateOnHide = false;
            }
        }
Пример #2
0
 private void HideRefreshIndicator()
 {
     if (this.isRefreshIndicatorShown)
     {
         ViewAnimation.ResetTransform(this.refreshIndicator);
         this.ResetRefreshIndicator();
     }
 }
        private Action GetTopViewKeyboardHiddenAnimationCallback(double duration)
        {
            if (this.topSection.IsHidden)
            {
                return(() => ViewAnimation.AnimateFadeIn(this.topSection.Views, duration));
            }

            return(() => ViewAnimation.ResetTransform(this.topSection.Views));
        }
Пример #4
0
        /// <summary>
        /// Handles view animations when the keyboard is hidden.
        /// </summary>
        /// <param name="e">The keyboard arguments for the event.</param>
        public override void AnimateOnHidden(UIKeyboardEventArgs e)
        {
            if (shouldAnimateOnHide)
            {
                UIView.Animate(e.AnimationDuration, () => ViewAnimation.ResetTransform(this.view));
            }

            shouldAnimateOnHide = false;
        }
Пример #5
0
 /// <summary>
 /// Called when transition out animation is completed.
 /// </summary>
 public void TransitionOutCompleted(ViewAnimation animation)
 {
     if (animation.Target != null && DeactiveViews)
     {
         if (animation.Target != ActiveView)
         {
             animation.Target.Deactivate();
         }
     }
 }
Пример #6
0
        private void ShowRefreshIndicator()
        {
            if (!this.isRefreshIndicatorShown)
            {
                ViewAnimation.AnimateMoveVertical(
                    Constants.RefreshIndicatorAnimationDuration,
                    Constants.RefreshIndicatorHeight,
                    this.refreshIndicator);

                this.isRefreshIndicatorShown = true;
            }
        }
Пример #7
0
        /// <summary>
        /// Handles view animations when the keyboard is shown.
        /// </summary>
        /// <param name="e">The keyboard arguments for the event.</param>
        public override void AnimateOnShown(UIKeyboardEventArgs e)
        {
            NSValue keyboardFrame     = (NSValue)e.Notification.UserInfo.ObjectForKey(UIKeyboard.FrameEndUserInfoKey);
            nfloat  maximumViewBottom = keyboardFrame.CGRectValue.Top - this.bottomPadding;

            if (this.view.Frame.Bottom > maximumViewBottom)
            {
                nfloat amountToTranslate = this.view.Frame.Bottom - maximumViewBottom;
                ViewAnimation.AnimateMoveVertical(e.AnimationDuration, -amountToTranslate, () => this.view.Superview.LayoutIfNeeded(), this.view);
                this.shouldAnimateOnHide = true;
            }
        }
        /// <summary>
        /// Handles view animations when the keyboard is hidden.
        /// </summary>
        /// <param name="e">The keyboard arguments for the event.</param>
        public override void AnimateOnHidden(UIKeyboardEventArgs e)
        {
            if (shouldAnimateOnHide)
            {
                UIView.Animate(
                    e.AnimationDuration,
                    () =>
                {
                    Action topSectionAnimation = this.GetTopViewKeyboardHiddenAnimationCallback(e.AnimationDuration);
                    topSectionAnimation();

                    ViewAnimation.ResetTransform(this.bottomSection.Views);
                });
            }

            shouldAnimateOnHide = false;
        }
Пример #9
0
        /// <summary>
        /// Initializes the view switcher.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            if (!String.IsNullOrEmpty(TransitionIn))
            {
                TransitionInAnimation = LayoutRoot.Find <ViewAnimation>(TransitionIn);
            }

            if (!String.IsNullOrEmpty(TransitionOut))
            {
                TransitionOutAnimation = LayoutRoot.Find <ViewAnimation>(TransitionOut);
                if (TransitionOutAnimation != null)
                {
                    TransitionOutAnimation.AnimationCompleted.AddEntry(new ViewActionEntry
                    {
                        ParentView            = this,
                        SourceView            = TransitionOutAnimation,
                        ViewActionFieldName   = "AnimationCompleted",
                        ViewActionHandlerName = "TransitionOutCompleted"
                    });
                }
            }

            if (!String.IsNullOrEmpty(TransitionInReverse))
            {
                TransitionInReverseAnimation = LayoutRoot.Find <ViewAnimation>(TransitionInReverse);
            }

            if (!String.IsNullOrEmpty(TransitionOutReverse))
            {
                TransitionOutReverseAnimation = LayoutRoot.Find <ViewAnimation>(TransitionOutReverse);
                if (TransitionOutReverseAnimation != null)
                {
                    TransitionOutReverseAnimation.AnimationCompleted.AddEntry(new ViewActionEntry
                    {
                        ParentView            = this,
                        SourceView            = TransitionOutReverseAnimation,
                        ViewActionFieldName   = "AnimationCompleted",
                        ViewActionHandlerName = "TransitionOutCompleted"
                    });
                }
            }

            if (!StartView.IsSet)
            {
                if (SwitchToDefault)
                {
                    if (ChildCount > 0)
                    {
                        SwitchTo(0, false);
                    }
                }
                else
                {
                    // deactive all views
                    if (DeactiveViews)
                    {
                        this.ForEachChild <View>(x => x.Deactivate(), false);
                    }
                }
            }
            else
            {
                SwitchTo(StartView, false);
            }
        }