@Override public void onAnimationEnd(View view) { mAnimator.setListener(null); // [WORKAROUND] // Issue 189686: NPE can be occurred when using the ViewPropertyAnimatorCompat // https://code.google.com/p/android/issues/detail?id=189686 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { InternalHelperKK.clearViewPropertyAnimatorUpdateListener(view); } else { mAnimator.setUpdateListener(null); } ViewCompat.setTranslationX(view, mToX); ViewCompat.setTranslationY(view, mToY); mActive.remove(mViewHolder); // [WORKAROUND] // issue #152 - bug:Samsung S3 4.1.1(Genymotion) with swipe left ViewParent itemParentView = mViewHolder.itemView.getParent(); if (itemParentView != null) { ViewCompat.postInvalidateOnAnimation((View) itemParentView); } if (mSwipeFinish != null) { mSwipeFinish.resultAction.slideAnimationEnd(); } // clean up mActive = null; mAnimator = null; mViewHolder = null; mAdapter = null; }
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(); }