示例#1
0
        public void MoveFrontView(float x)
        {
            if (x < -MoveDist && (_holderMove == Moving.Right || _holderMove == Moving.Unknown))
            {
                if (_holderMove == Moving.Unknown)
                {
                    _holderMove = Moving.Left;
                    ResetAnimation();
                }
                else
                {
                    _holderMove = Moving.Left;
                    SwitchColorBackGround();
                }
            }
            else if (x > MoveDist && (_holderMove == Moving.Left || _holderMove == Moving.Unknown))
            {
                if (_holderMove == Moving.Unknown)
                {
                    _holderMove = Moving.Right;
                    ResetAnimation();
                }
                else
                {
                    _holderMove = Moving.Right;
                    SwitchColorBackGround();
                }
            }

            ViewCompat.SetTranslationX(FrontView, x);
        }
示例#2
0
        private void animateRemoveImpl(RecyclerView.ViewHolder holder)
        {
            View view = holder.ItemView;

            ViewCompat.Animate(view).Cancel();
            ViewCompat.Animate(view).SetDuration(RemoveDuration).
            TranslationX(-mRecyclerView.Width).WithEndAction(() =>
            {
                ViewCompat.SetTranslationX(view, -mRecyclerView.getWidth());
                dispatchRemoveFinished(holder);
                mRemoveAnimations.remove(holder);
                dispatchFinishedWhenDone();
            }
                                                             ).Start();
            mRemoveAnimations.Add(holder);
        }
示例#3
0
        public override void EndAnimation(RecyclerView.ViewHolder item)
        {
            View view = item.itemView;

            ViewCompat.Animate(view).Cancel();
            if (mPendingMoves.Contains(item))
            {
                ViewCompat.SetTranslationY(view, 0);
                ViewCompat.SetTranslationX(view, 0);
                dispatchMoveFinished(item);
                mPendingMoves.remove(item);
            }
            if (mPendingRemovals.contains(item))
            {
                dispatchRemoveFinished(item);
                mPendingRemovals.remove(item);
            }
            if (mPendingAdditions.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchAddFinished(item);
                mPendingAdditions.remove(item);
            }
            if (mMoveAnimations.contains(item))
            {
                ViewCompat.setTranslationY(view, 0);
                ViewCompat.setTranslationX(view, 0);
                dispatchMoveFinished(item);
                mMoveAnimations.remove(item);
            }
            if (mRemoveAnimations.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchRemoveFinished(item);
                mRemoveAnimations.remove(item);
            }
            if (mAddAnimations.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchAddFinished(item);
                mAddAnimations.remove(item);
            }
            dispatchFinishedWhenDone();
        }
示例#4
0
 public override bool AnimateAdd(RecyclerView.ViewHolder holder)
 {
     ViewCompat.SetTranslationX(holder.itemView, -mRecyclerView.getWidth());
     mPendingAdditions.add(holder);
     return(true);
 }