Esempio n. 1
0
        public static void FadeView(View view, bool fadeIn, SimpleAnimator.AnimationComplete onComplete)
        {
            float startAlpha = fadeIn == true ? 0.00f : 1.00f;
            float endAlpha   = fadeIn == true ? 1.00f : 0.00f;

            SimpleAnimator_Float floatAnim = new SimpleAnimator_Float(startAlpha, endAlpha, .15f,
                                                                      delegate(float percent, object value)
            {
                view.Alpha = (float)value;
            },
                                                                      delegate
            {
                if (onComplete != null)
                {
                    onComplete( );
                }
            });

            floatAnim.Start( );
        }
Esempio n. 2
0
 public void Hide(SimpleAnimator.AnimationComplete onCompletion = null)
 {
     Util.AnimateBackgroundOpacity(View, 0.00f, onCompletion);
     Util.AnimateBackgroundOpacity(BusyIndicator, 0.00f, null);
 }
Esempio n. 3
0
        void AnimateImageView(View imageView, PointF startPos, PointF endPos, System.Drawing.SizeF startSize, System.Drawing.SizeF endSize, float duration, SimpleAnimator.AnimationComplete completeDelegate)
        {
            // calculate the deltas once before we start
            float xDelta = endPos.X - startPos.X;
            float yDelta = endPos.Y - startPos.Y;

            float deltaWidth  = endSize.Width - startSize.Width;
            float deltaHeight = endSize.Height - startSize.Height;

            // create an animator
            SimpleAnimator_Float imageAnimator = new SimpleAnimator_Float(0.00f, 1.00f, duration,
                                                                          delegate(float percent, object value)
            {
                Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                {
                    // each update, interpolate the deltas and apply
                    imageView.SetX(startPos.X + (xDelta * percent));
                    imageView.SetY(startPos.Y + (yDelta * percent));

                    imageView.LayoutParameters.Width  = (int)(startSize.Width + (deltaWidth * percent));
                    imageView.LayoutParameters.Height = (int)(startSize.Height + (deltaHeight * percent));

                    // force the image to re-evaluate its size
                    imageView.RequestLayout( );
                });
            },
                                                                          //ANIMATION COMPLETE
                                                                          delegate
            {
                if (completeDelegate != null)
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                    {
                        completeDelegate( );
                    });
                }
            });

            imageAnimator.Start( );
        }
Esempio n. 4
0
        public static void AnimateViewColor(uint currColor, uint targetColor, View uiView, SimpleAnimator.AnimationComplete complete)
        {
            SimpleAnimator_Color viewAnimator = new SimpleAnimator_Color(currColor, targetColor, .15f, delegate(float percent, object value)
            {
                uiView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor((uint)value));
            }
                                                                         ,
                                                                         delegate
            {
                complete( );
            });

            viewAnimator.Start( );
        }
Esempio n. 5
0
        public static void AnimateBackgroundColor(PlatformBaseUI view, uint targetColor, SimpleAnimator.AnimationComplete onCompletion = null)
        {
            SimpleAnimator_Color animator = new SimpleAnimator_Color(view.BackgroundColor, targetColor, .15f, delegate(float percent, object value)
            {
                view.BackgroundColor = (uint)value;
            }
                                                                     , onCompletion);

            animator.Start( );
        }
Esempio n. 6
0
        public static void AnimateBackgroundOpacity(PlatformBaseUI view, float targetOpacity, SimpleAnimator.AnimationComplete onCompletion = null)
        {
            SimpleAnimator_Float animator = new SimpleAnimator_Float(view.Opacity, targetOpacity, .15f, delegate(float percent, object value)
            {
                view.Opacity = (float)value;
            }
                                                                     , onCompletion);

            animator.Start( );
        }