Пример #1
0
        public void SetCardImage(int drawbleId, bool vertical)
        {
            // If this is already our card image, don't reanimate
            if (drawbleId == currentDrawableId)
            {
                return;
            }

            currentDrawableId = drawbleId;

            int objAnim = vertical ? Resource.Animation.flipping_out_vert : Resource.Animation.flipping_out;
            int bakAnim = Resource.Animation.fade_out;

            CompatibilityAnimation compatibilityAnimationOut = new CompatibilityAnimation(Context, objAnim, bakAnim);

            if (ChildCount > 0)
            {
                ImageView imageView = (ImageView) GetChildAt(0);
                compatibilityAnimationOut.Duration = 350;
                compatibilityAnimationOut.AnimatioEnd = () => Handler.Post(() => RemoveView(imageView));
                compatibilityAnimationOut.StartAnimation(imageView);
            }

            ImageView imageView2 = new ImageView(Context);
            imageView2.SetImageResource(drawbleId);
            imageView2.Visibility = ViewStates.Invisible;
            AddView(imageView2);

            objAnim = vertical ? Resource.Animation.flipping_in_vert : Resource.Animation.flipping_in;
            bakAnim = Resource.Animation.fade_in;
            CompatibilityAnimation compatibilityAnimationIn = new CompatibilityAnimation(Context, objAnim, bakAnim);
            compatibilityAnimationIn.Duration = 350;
            compatibilityAnimationIn.Delay = 350;
            compatibilityAnimationIn.AnimationStart += () =>
            {
                imageView2.Visibility = ViewStates.Visible;
            };
            compatibilityAnimationIn.StartAnimation(imageView2);
        }
Пример #2
0
        public void SetCardImage(int drawableId, bool vertical)
        {
            int objectAnimation = vertical ? Resource.Animation.flipping_out_vert : Resource.Animation.flipping_out;
            int backAnim = Resource.Animation.fade_out;

            CompatibilityAnimation compatibilityAnimationOut = new CompatibilityAnimation(Context, objectAnimation, backAnim);

            if (cardImageLayout.ChildCount > 0)
            {
                ImageView imageView = (ImageView) cardImageLayout.GetChildAt(0);
                compatibilityAnimationOut.Duration = 350;
                compatibilityAnimationOut.AnimatioEnd += () => Handler.Post(() => cardImageLayout.RemoveView(imageView));

                compatibilityAnimationOut.StartAnimation(imageView);
            }

            ImageView imageView2 = new ImageView(Context);
            imageView2.SetImageResource(drawableId);
            imageView2.Visibility = ViewStates.Invisible;
            cardImageLayout.AddView(imageView2);

            objectAnimation = vertical ? Resource.Animation.flipping_in_vert : Resource.Animation.flipping_in;
            backAnim = Resource.Animation.fade_in;

            CompatibilityAnimation compatibilityAnimationIn = new CompatibilityAnimation(Context, objectAnimation, backAnim);
            compatibilityAnimationIn.Duration = 350;
            compatibilityAnimationIn.Delay = 350;
            compatibilityAnimationIn.AnimationStart += () => imageView2.Visibility = ViewStates.Visible;

            compatibilityAnimationIn.StartAnimation(imageView2);

        }