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); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: @Override public boolean animateAdd(final android.support.v7.widget.RecyclerView.ViewHolder holder) public override bool animateAdd(RecyclerView.ViewHolder holder) { resetAnimation(holder); ViewCompat.setAlpha(holder.itemView, 0); mPendingAdditions.Add(holder); return(true); }
public override void onAnimationEnd(View view) { animation.Listener = null; ViewCompat.setAlpha(view, 1); dispatchRemoveFinished(holder); outerInstance.mRemoveAnimations.Remove(holder); outerInstance.dispatchFinishedWhenDone(); }
public override void onAnimationEnd(View view) { newViewAnimation.Listener = null; ViewCompat.setAlpha(newView, 1); ViewCompat.setTranslationX(newView, 0); ViewCompat.setTranslationY(newView, 0); dispatchChangeFinished(changeInfo.newHolder, false); outerInstance.mChangeAnimations.Remove(changeInfo.newHolder); outerInstance.dispatchFinishedWhenDone(); }
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(); }
private bool endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerView.ViewHolder item) { bool oldItem = false; if (changeInfo.newHolder == item) { changeInfo.newHolder = null; } else if (changeInfo.oldHolder == item) { changeInfo.oldHolder = null; oldItem = true; } else { return(false); } ViewCompat.setAlpha(item.itemView, 1); ViewCompat.setTranslationX(item.itemView, 0); ViewCompat.setTranslationY(item.itemView, 0); dispatchChangeFinished(item, oldItem); return(true); }
public override void EndAnimations() { int count = mPendingMoves.size(); for (int i = count - 1; i >= 0; i--) { MoveInfo item = mPendingMoves.get(i); View view = item.holder.itemView; ViewCompat.animate(view).cancel(); ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(item.holder); mPendingMoves.remove(item); } count = mPendingRemovals.size(); for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mPendingRemovals.get(i); dispatchRemoveFinished(item); mPendingRemovals.remove(item); } count = mPendingAdditions.size(); for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mPendingAdditions.get(i); View view = item.itemView; ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); mPendingAdditions.remove(item); } if (!isRunning()) { return; } count = mMoveAnimations.size(); for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mMoveAnimations.get(i); View view = item.itemView; ViewCompat.animate(view).cancel(); ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(item); mMoveAnimations.remove(item); } count = mRemoveAnimations.size(); for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mRemoveAnimations.get(i); View view = item.itemView; ViewCompat.animate(view).cancel(); ViewCompat.setAlpha(view, 1); dispatchRemoveFinished(item); mRemoveAnimations.remove(item); } count = mAddAnimations.size(); for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mAddAnimations.get(i); View view = item.itemView; ViewCompat.animate(view).cancel(); ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); mAddAnimations.remove(item); } mMoves.clear(); mAdditions.clear(); dispatchAnimationsFinished(); }
public override void endAnimations() { int count = mPendingMoves.Count; for (int i = count - 1; i >= 0; i--) { MoveInfo item = mPendingMoves[i]; View view = item.holder.itemView; ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(item.holder); mPendingMoves.RemoveAt(i); } count = mPendingRemovals.Count; for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mPendingRemovals[i]; dispatchRemoveFinished(item); mPendingRemovals.RemoveAt(i); } count = mPendingAdditions.Count; for (int i = count - 1; i >= 0; i--) { RecyclerView.ViewHolder item = mPendingAdditions[i]; View view = item.itemView; ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); mPendingAdditions.RemoveAt(i); } count = mPendingChanges.Count; for (int i = count - 1; i >= 0; i--) { endChangeAnimationIfNecessary(mPendingChanges[i]); } mPendingChanges.Clear(); if (!Running) { return; } int listCount = mMovesList.Count; for (int i = listCount - 1; i >= 0; i--) { List <MoveInfo> moves = mMovesList[i]; count = moves.Count; for (int j = count - 1; j >= 0; j--) { MoveInfo moveInfo = moves[j]; RecyclerView.ViewHolder item = moveInfo.holder; View view = item.itemView; ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(moveInfo.holder); moves.RemoveAt(j); if (moves.Count == 0) { mMovesList.Remove(moves); } } } listCount = mAdditionsList.Count; for (int i = listCount - 1; i >= 0; i--) { List <RecyclerView.ViewHolder> additions = mAdditionsList[i]; count = additions.Count; for (int j = count - 1; j >= 0; j--) { RecyclerView.ViewHolder item = additions[j]; View view = item.itemView; ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); additions.RemoveAt(j); if (additions.Count == 0) { mAdditionsList.Remove(additions); } } } listCount = mChangesList.Count; for (int i = listCount - 1; i >= 0; i--) { List <ChangeInfo> changes = mChangesList[i]; count = changes.Count; for (int j = count - 1; j >= 0; j--) { endChangeAnimationIfNecessary(changes[j]); if (changes.Count == 0) { mChangesList.Remove(changes); } } } cancelAll(mRemoveAnimations); cancelAll(mMoveAnimations); cancelAll(mAddAnimations); cancelAll(mChangeAnimations); dispatchAnimationsFinished(); }
public override void endAnimation(RecyclerView.ViewHolder item) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View view = item.itemView; View view = item.itemView; // this will trigger end callback which should set properties to their target values. ViewCompat.animate(view).cancel(); onPreEndAnimation(item); // TODO if some other animations are chained to end, how do we cancel them as well? for (int i = mPendingMoves.Count - 1; i >= 0; i--) { MoveInfo moveInfo = mPendingMoves[i]; if (moveInfo.holder == item) { ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(item); mPendingMoves.RemoveAt(i); } } endChangeAnimation(mPendingChanges, item); if (mPendingRemovals.Remove(item)) { ViewCompat.setAlpha(view, 1); dispatchRemoveFinished(item); } if (mPendingAdditions.Remove(item)) { ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); } for (int i = mChangesList.Count - 1; i >= 0; i--) { List <ChangeInfo> changes = mChangesList[i]; endChangeAnimation(changes, item); if (changes.Count == 0) { mChangesList.RemoveAt(i); } } for (int i = mMovesList.Count - 1; i >= 0; i--) { List <MoveInfo> moves = mMovesList[i]; for (int j = moves.Count - 1; j >= 0; j--) { MoveInfo moveInfo = moves[j]; if (moveInfo.holder == item) { ViewCompat.setTranslationY(view, 0); ViewCompat.setTranslationX(view, 0); dispatchMoveFinished(item); moves.RemoveAt(j); if (moves.Count == 0) { mMovesList.RemoveAt(i); } break; } } } for (int i = mAdditionsList.Count - 1; i >= 0; i--) { List <RecyclerView.ViewHolder> additions = mAdditionsList[i]; if (additions.Remove(item)) { ViewCompat.setAlpha(view, 1); dispatchAddFinished(item); if (additions.Count == 0) { mAdditionsList.RemoveAt(i); } } } onPostEndAnimation(item); // animations should be ended by the cancel above. if (mRemoveAnimations.Remove(item) && DEBUG) { throw new System.InvalidOperationException("after animation is cancelled, item should not be in " + "mRemoveAnimations list"); } if (mAddAnimations.Remove(item) && DEBUG) { throw new System.InvalidOperationException("after animation is cancelled, item should not be in " + "mAddAnimations list"); } if (mChangeAnimations.Remove(item) && DEBUG) { throw new System.InvalidOperationException("after animation is cancelled, item should not be in " + "mChangeAnimations list"); } if (mMoveAnimations.Remove(item) && DEBUG) { throw new System.InvalidOperationException("after animation is cancelled, item should not be in " + "mMoveAnimations list"); } dispatchFinishedWhenDone(); }
public override void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); }