コード例 #1
0
ファイル: ExceptionHelper.cs プロジェクト: paul-pagnan/helps
        public static void NoConnection()
        {
            var context = ViewHelper.CurrentActivity();
            context.RunOnUiThread(delegate
            {
                var NoConnection = context.FindViewById(Resource.Id.NoConnection);
                if (NoConnection != null)
                {
                    NoConnection.Visibility = ViewStates.Visible;

                    new Handler().PostDelayed(delegate
                    {
                        Android.Views.Animations.Animation fadeOut = new AlphaAnimation(1, 0);
                        fadeOut.Interpolator = new DecelerateInterpolator();
                        fadeOut.Duration = 1000;

                        AnimationSet animation = new AnimationSet(false);
                        animation.AddAnimation(fadeOut);
                        NoConnection.Animation = animation;
                        NoConnection.StartAnimation(animation);
                        new Handler().PostDelayed(delegate { NoConnection.Visibility = ViewStates.Gone; }, 1000);
                    }, 2000);
                }
            });
        }
コード例 #2
0
 public BallService()
 {
     this.AniSet = new AnimationSet(true);
     var rotat = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
     rotat.RepeatMode = RepeatMode.Reverse;
     rotat.Duration = 500;
     //rotat.AnimationStart += Ani_AnimationStart;
     //rotat.AnimationEnd += Ani_AnimationEnd;
     rotat.FillBefore = true;
     //AccelerateDecelerateInterpolator  �ȼ��ٺ����
     rotat.Interpolator = new AccelerateDecelerateInterpolator();
     this.AniSet.AddAnimation(rotat);
 }
コード例 #3
0
 public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     if (Math.Abs(velocityX) < 500) return false;
     _lastView = _parentActivity.LastView;
     var animationSet = new AnimationSet(true)
     {
         Interpolator = new AccelerateDecelerateInterpolator(),
         Duration = 300,
         FillAfter = true
     };
     var animationRotate = new RotateAnimation(0, Math.Sign(velocityX)*15);
     var animationTranslate = new TranslateAnimation(0, Math.Sign(velocityX)*400,
         0, 10);
     var animationAlpha = new AlphaAnimation(1, 0);
     animationSet.AddAnimation(animationRotate);
     animationSet.AddAnimation(animationTranslate);
     animationSet.AddAnimation(animationAlpha);
     animationSet.AnimationEnd += AnimationSet_AnimationEnd;
     _lastView.StartAnimation(animationSet);
     return true;
 }
コード例 #4
0
ファイル: OnClicklistener.cs プロジェクト: veresbogdan/MMD
        private static Animation createItemDisapperAnimation(long duration, bool isClicked)
        {
            AnimationSet animationSet = new AnimationSet(true);
            animationSet.AddAnimation(
                new ScaleAnimation(
                    1.0f,
                    isClicked ? 2.0f : 0.0f,
                    1.0f,
                    isClicked ? 2.0f : 0.0f,
                    Dimension.RelativeToSelf,
                    0.5f,
                    Dimension.RelativeToSelf,
                    0.5f));
            animationSet.AddAnimation(new AlphaAnimation(1.0f, 0.0f));

            animationSet.Duration = duration;
            animationSet.Interpolator = new DecelerateInterpolator();
            animationSet.FillAfter = true;

            return animationSet;
        }
コード例 #5
0
ファイル: ArcLayout.cs プロジェクト: veresbogdan/MMD
        private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
            long startOffset, long duration, IInterpolator interpolator)
        {
            AnimationSet animationSet = new AnimationSet(false);
            animationSet.FillAfter = true;

            long preDuration = duration / 2;
            Animation rotateAnimation = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f,
                    Dimension.RelativeToSelf, 0.5f);
            rotateAnimation.StartOffset = startOffset;
            rotateAnimation.Duration = preDuration;
            rotateAnimation.Interpolator = new LinearInterpolator();
            rotateAnimation.FillAfter = true;

            animationSet.AddAnimation(rotateAnimation);

            Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
            translateAnimation.StartOffset = startOffset + preDuration;
            translateAnimation.Duration = duration - preDuration;
            translateAnimation.Interpolator = interpolator;
            translateAnimation.FillAfter = true;

            animationSet.AddAnimation(translateAnimation);

            return animationSet;
        }
コード例 #6
0
        private void animateAlphaTranslate(View view, float alphaFrom, float alphaTo, float xFrom, float xTo,
            bool requestFocus)
        {
            AnimationSet animationSet = new AnimationSet(true);

            AlphaAnimation fade = new AlphaAnimation(alphaFrom, alphaTo);
            fade.Duration = 350;

            TranslateAnimation slide = new TranslateAnimation(Dimension.RelativeToSelf, xFrom,
                                                              Dimension.RelativeToSelf, xTo,
                                                              Dimension.RelativeToSelf, 0,
                                                              Dimension.RelativeToSelf, 0);

            slide.Duration = 350;

            animationSet.AddAnimation(fade);
            animationSet.AddAnimation(slide);
            view.StartAnimation(animationSet);

            if (requestFocus)
            {
                animationSet.AnimationEnd += (obj, args) => view.RequestFocus();
            }
        }
コード例 #7
0
        private void MaximizeView(View view)
        {
            var animationSet = new AnimationSet(true)
            {
                Interpolator = new AccelerateDecelerateInterpolator(),
                Duration = 500,
                FillAfter = true
            };
            var scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f, Dimension.RelativeToSelf, 0f,
                Dimension.RelativeToSelf, 0f);
            _selectedViewTop = view.Top;
            _selectedViewLeft = view.Left;
            var translateAnimation = new TranslateAnimation(Dimension.RelativeToSelf, 0, Dimension.Absolute, -view.Left,
                Dimension.RelativeToSelf, 0, Dimension.Absolute, -view.Top + _addButton.Height);
            animationSet.AddAnimation(scaleAnimation);
            animationSet.AddAnimation(translateAnimation);

            view.StartAnimation(animationSet);
        }
コード例 #8
0
        public void ShowInvalid(string errorMessage)
        {
            nextMustBeDeleted = true;
            textErrorView.Text = errorMessage;
            AddView(textErrorView);
            textErrorView.Visibility = ViewStates.Visible;

            AnimationSet animationSet = new AnimationSet(true);

            AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
            fadeIn.Duration = 300;

            AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
            fadeOut.StartOffset = 300 + 300;
            fadeOut.Duration = 300;

            animationSet.AddAnimation(fadeIn);
            animationSet.AddAnimation(fadeOut);

            animationSet.FillAfter = true;
            animationSet.FillBefore = true;

            animationSet.AnimationEnd += (sender, args) =>
            {
                textErrorView.Visibility = ViewStates.Gone;
                RemoveView(textErrorView);
            };

            textErrorView.StartAnimation(animationSet);
        }
コード例 #9
0
        /**
         * The {@code FlipDirection} enumeration defines the most typical flip view transitions: left-to-right and right-to-left. {@code FlipDirection} is used during the creation of {@link FlipAnimation} animations.
         * 
         * @author Ephraim A. Tekle
         *
         */
        /**
	 * Create a pair of {@link FlipAnimation} that can be used to flip 3D transition from {@code fromView} to {@code toView}. A typical use case is with {@link ViewAnimator} as an out and in transition.
	 * 
	 * NOTE: Avoid using this method. Instead, use {@link #flipTransition}.
	 *  
	 * @param fromView the view transition away from
	 * @param toView the view transition to
	 * @param dir the flip direction
	 * @param duration the transition duration in milliseconds
	 * @param interpolator the interpolator to use (pass {@code null} to use the {@link AccelerateInterpolator} interpolator) 
	 * @return
	 */

        public static Animation[] FlipAnimation(View fromView, View toView, FlipDirection dir, long duration, IInterpolator interpolator)
        {
            Animation[] result = new Animation[2];
            float centerX;
            float centerY;

            centerX = fromView.Width/2.0f;
            centerY = fromView.Height/2.0f;

            FlipAnimation outFlip = new FlipAnimation(0, dir.EndDegreeForFirstView(), centerX, centerY,
                SpotTiles.FlipAnimation.ScaleDefault, ScaleUpDownEnum.ScaleDown);
            outFlip.Duration = duration;
            outFlip.FillAfter = true;
            outFlip.Interpolator = interpolator ?? new AccelerateInterpolator();

            if (dir == FlipDirection.BottomTop || dir == FlipDirection.TopBottom)
                outFlip.Direction = Direction.X;
            else
                outFlip.Direction = Direction.Y;

            AnimationSet outAnimation = new AnimationSet(true);
            outAnimation.AddAnimation(outFlip);
            result[0] = outAnimation;

            // Uncomment the following if toView has its layout established (not the case if using ViewFlipper and on first show)
            //centerX = toView.getWidth() / 2.0f;
            //centerY = toView.getHeight() / 2.0f; 

            FlipAnimation inFlip = new FlipAnimation(dir.StartDegreeForSecondView(), 0, centerX, centerY,
                SpotTiles.FlipAnimation.ScaleDefault, ScaleUpDownEnum.ScaleUp);
            inFlip.Duration = duration;
            inFlip.FillAfter = true;
            inFlip.StartOffset = duration;
            inFlip.Interpolator = interpolator ?? new AccelerateInterpolator();


            if (dir == FlipDirection.BottomTop || dir == FlipDirection.TopBottom)
                outFlip.Direction = Direction.X;
            else
                outFlip.Direction = Direction.Y;

            AnimationSet inAnimation = new AnimationSet(true);
            inAnimation.AddAnimation(inFlip);
            result[1] = inAnimation;

            return result;

        }
コード例 #10
0
/**
 * Fades the view in, delays the specified amount of time, then fades the view out
 * @param v the view to be faded in then out
 * @param delay how long the view will be visible for
 */

        public static void FadeInThenOut(View v, long delay)
        {
            if (v == null) return;

            v.Visibility = ViewStates.Visible;
            AnimationSet animation = new AnimationSet(true);
            Animation[] fadeInOut = FadeInThenOutAnimation(500, delay);
            animation.AddAnimation(fadeInOut[0]);
            animation.AddAnimation(fadeInOut[1]);
            animation.AnimationEnd += (sender, args) => v.Visibility = ViewStates.Gone;
            animation.AnimationStart += (sender, args) => v.Visibility = ViewStates.Visible;

        }