private long cancelAnimatorAndGetNewDuration(long duration,ValueAnimator previousAnimator){
  long newDuration=duration;
  if (previousAnimator != null) {
    newDuration=Math.max(previousAnimator.getDuration() - previousAnimator.getCurrentPlayTime(),newDuration);
    previousAnimator.cancel();
  }
  return newDuration;
}

private long cancelAnimatorAndGetNewDuration ( long duration , ValueAnimator previousAnimator ) { long newDuration = duration ; if ( previousAnimator != null ) { newDuration = Math . max ( previousAnimator . getDuration ( ) - previousAnimator . getCurrentPlayTime ( ) , newDuration ) ; previousAnimator . cancel ( ) ; } return newDuration ; }
cancel the previous animator and get the duration of the new animation .
