private void animateChangeImpl(DefaultItemAnimator.ChangeInfo paramChangeInfo) { View localView = null; Object localObject = oldHolder; if (localObject == null) {} for (localObject = null;; localObject = itemView) { RecyclerView.ViewHolder localViewHolder = newHolder; if (localViewHolder != null) { localView = itemView; } if (localObject != null) { localObject = ViewCompat.animate((View)localObject).setDuration(getChangeDuration()); mChangeAnimations.add(oldHolder); ((ViewPropertyAnimatorCompat)localObject).translationX(toX - fromX); ((ViewPropertyAnimatorCompat)localObject).translationY(toY - fromY); ((ViewPropertyAnimatorCompat)localObject).alpha(0.0F).setListener(new DefaultItemAnimator.7(this, paramChangeInfo, (ViewPropertyAnimatorCompat)localObject)).start(); } if (localView != null) { localObject = ViewCompat.animate(localView); mChangeAnimations.add(newHolder); ((ViewPropertyAnimatorCompat)localObject).translationX(0.0F).translationY(0.0F).setDuration(getChangeDuration()).alpha(1.0F).setListener(new DefaultItemAnimator.8(this, paramChangeInfo, (ViewPropertyAnimatorCompat)localObject, localView)).start(); } return; } }
void start() { final View containerView = ((SwipeableItemViewHolder) mViewHolder).getSwipeableContainerView(); mInvSize = (1.0f / Math.max(1.0f, mHorizontal ? containerView.getWidth() : containerView.getHeight())); // setup animator mAnimator = ViewCompat.animate(containerView); mAnimator.setDuration(mDuration); mAnimator.translationX(mToX); mAnimator.translationY(mToY); if (mInterpolator != null) { mAnimator.setInterpolator(mInterpolator); } mAnimator.setListener(this); mAnimator.setUpdateListener(this); // start mActive.add(mViewHolder); mAnimator.start(); }
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; mChangeAnimations.add(changeInfo.oldHolder); final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view).setDuration(getChangeDuration()); oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX); oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY); oldViewAnim .alpha(0) .setListener( new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.oldHolder, true); } @Override public void onAnimationEnd(View view) { oldViewAnim.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); dispatchChangeFinished(changeInfo.oldHolder, true); mChangeAnimations.remove(changeInfo.oldHolder); dispatchFinishedWhenDone(); } }) .start(); if (newView != null) { mChangeAnimations.add(changeInfo.newHolder); final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView); newViewAnimation .translationX(0) .translationY(0) .setDuration(getChangeDuration()) .alpha(1) .setListener( new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.newHolder, false); } @Override public void onAnimationEnd(View view) { newViewAnimation.setListener(null); ViewCompat.setAlpha(newView, 1); ViewCompat.setTranslationX(newView, 0); ViewCompat.setTranslationY(newView, 0); dispatchChangeFinished(changeInfo.newHolder, false); mChangeAnimations.remove(changeInfo.newHolder); dispatchFinishedWhenDone(); } }) .start(); } }