示例#1
0
        public virtual void Discard(int direction, Animator.IAnimatorListener al, int duration = 250)
        {
            var @as         = new AnimatorSet();
            var aCollection = new List <Animator>();

            var topView     = TopView;
            var topParams   = (RelativeLayout.LayoutParams)topView.LayoutParameters;
            var layout      = CardUtils.CloneParams(topParams);
            var discardAnim = ValueAnimator.OfObject(new RelativeLayoutParamsEvaluator(), layout,
                                                     _mRemoteLayouts[direction]);

            discardAnim.Update +=
                (sender, args) =>
            {
                topView.LayoutParameters = (RelativeLayout.LayoutParams)args.Animation.AnimatedValue;
            };

            discardAnim.SetDuration(duration);
            aCollection.Add(discardAnim);

            for (var i = 0; i < MCardCollection.Count; i++)
            {
                var v = MCardCollection[i];

                if (v == topView)
                {
                    continue;
                }

                var nv           = MCardCollection[i + 1];
                var layoutParams = (RelativeLayout.LayoutParams)v.LayoutParameters;
                var endLayout    = CardUtils.CloneParams(layoutParams);
                RelativeLayout.LayoutParams viewParams;
                _mLayoutsMap.TryGetValue(nv, out viewParams);
                var layoutAnim = ValueAnimator.OfObject(new RelativeLayoutParamsEvaluator(), endLayout, viewParams);
                layoutAnim.SetDuration(duration);
                layoutAnim.Update +=
                    (sender, args) =>
                {
                    v.LayoutParameters = (RelativeLayout.LayoutParams)args.Animation.AnimatedValue;
                };
                aCollection.Add(layoutAnim);
            }

            @as.AddListener(new DiscardAnimationEndListener(this, al));
            @as.PlayTogether(aCollection);
            @as.Start();
        }
示例#2
0
        /// <summary>
        /// Animates a view by changing its Y translation property.
        /// </summary>
        public static ObjectAnimator TranslateToY(this View v, float to, long duration,
                                                  ITimeInterpolator interpolator, Animator.IAnimatorListener listener)
        {
            float from = v.TranslationY;

            //No special skipping

            var animator = ObjectAnimator.OfFloat(v, "translationY", from, to);

            animator.SetInterpolator(interpolator);
            animator.SetDuration(duration);
            if (listener != null)
            {
                animator.AddListener(listener);
            }
            animator.Start();

            return(animator);
        }
示例#3
0
 public void RemoveAnimatorListener(Animator.IAnimatorListener l)
 {
     AnimatorAgent.RemoveListener(l);
 }
示例#4
0
 public BaseViewAnimator AddAnimatorListener(Animator.IAnimatorListener l)
 {
     AnimatorAgent.AddListener(l);
     return(this);
 }
 public void addAnimatorListener(Animator.IAnimatorListener animatorListener)
 {
     animator.AddListener(animatorListener);
 }
示例#6
0
 public AnimatorListenerWrapper(Animator anim, Animator.IAnimatorListener listener)
 {
     _animator = anim;
     _listener = listener;
 }
示例#7
0
 public static ObjectAnimator SlideOut(this View v, long duration, Animator.IAnimatorListener listener)
 {
     return(TranslateToY(v, 0f, duration, new DecelerateInterpolator(), listener));
 }
示例#8
0
 public static ObjectAnimator SlideIn(this View v, float viewHeight, long duration, Animator.IAnimatorListener listener)
 {
     return(TranslateToY(v, -viewHeight, duration, new DecelerateInterpolator(), listener));
 }
示例#9
0
 public DiscardAnimationEndListener(CardAnimator outerInstance, Animator.IAnimatorListener al)
 {
     _outerInstance = outerInstance;
     _al            = al;
 }
 public BaseViewAnimator addAnimatorListener(Animator.IAnimatorListener l)
 {
     mAnimatorSet.AddListener(l);
     return(this);
 }
 public void removeAnimatorListener(Animator.IAnimatorListener l)
 {
     mAnimatorSet.RemoveListener(l);
 }