Code example for Animator

Methods: cancel

0
     * Helper method to start animation. 
     */ 
    private void startLayoutAnimation(int duration, AnimatorListener listener,
            PropertyValuesHolder... values) {
        if (mLastAnimator != null) {
            mLastAnimator.cancel();
        } 
        if (mLastAnimatorListener != null) {
            if (ANIMATION_DEBUG) {
                Log.w(Logging.LOG_TAG, "Anim: Cancelling last animation: " + mLastAnimator);
            } 
            // Animator.cancel() doesn't call listener.cancel() immediately, so sometimes 
            // we end up cancelling the previous one *after* starting the next one. 
            // Directly tell the listener it's cancelled to avoid that. 
            mLastAnimatorListener.cancel();
        } 
 
        final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(
                this, values).setDuration(duration);
        animator.setInterpolator(INTERPOLATOR);
        if (listener != null) {