Exemplo n.º 1
0
        public override bool animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, int fromX, int fromY, int toX, int toY)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final float prevTranslationX = android.support.v4.view.ViewCompat.getTranslationX(oldHolder.itemView);
            float prevTranslationX = ViewCompat.getTranslationX(oldHolder.itemView);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final float prevTranslationY = android.support.v4.view.ViewCompat.getTranslationY(oldHolder.itemView);
            float prevTranslationY = ViewCompat.getTranslationY(oldHolder.itemView);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final float prevAlpha = android.support.v4.view.ViewCompat.getAlpha(oldHolder.itemView);
            float prevAlpha = ViewCompat.getAlpha(oldHolder.itemView);

            resetAnimation(oldHolder);
            int deltaX = (int)(toX - fromX - prevTranslationX);
            int deltaY = (int)(toY - fromY - prevTranslationY);

            // recover prev translation state after ending animation
            ViewCompat.setTranslationX(oldHolder.itemView, prevTranslationX);
            ViewCompat.setTranslationY(oldHolder.itemView, prevTranslationY);
            ViewCompat.setAlpha(oldHolder.itemView, prevAlpha);
            if (newHolder != null && newHolder.itemView != null)
            {
                // carry over translation values
                resetAnimation(newHolder);
                ViewCompat.setTranslationX(newHolder.itemView, -deltaX);
                ViewCompat.setTranslationY(newHolder.itemView, -deltaY);
                ViewCompat.setAlpha(newHolder.itemView, 0);
            }
            mPendingChanges.Add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
            return(true);
        }