private void setCurrentPlayTimeByStateAndPlay(long[] tab, State mState) { switch (mState) { case ANIMATING_LINE_TO_DOT: mArrowToLineAnimatorSet.start(); for (int i = 0; i < mArrowToLineAnimatorSet.getChildAnimations().size(); i++) { ((ValueAnimator) mArrowToLineAnimatorSet.getChildAnimations().get(i)) .setCurrentPlayTime(tab[i]); } break; case ANIMATING_PROGRESS: mProgressAnimationSet.start(); for (int i = 0; i < mProgressAnimationSet.getChildAnimations().size(); i++) { ((ValueAnimator) mProgressAnimationSet.getChildAnimations().get(i)) .setCurrentPlayTime(tab[i]); } break; case ANIMATING_ERROR: mErrorAnimation.start(); mErrorAnimation.setCurrentPlayTime(tab[0]); break; case ANIMATING_SUCCESS: mSuccessAnimation.start(); mSuccessAnimation.setCurrentPlayTime(tab[0]); break; } }
private long[] getCurrentPlayTimeByState(State mState) { long[] tab = new long[3]; switch (mState) { case ANIMATING_LINE_TO_DOT: for (int i = 0; i < mArrowToLineAnimatorSet.getChildAnimations().size(); i++) { tab[i] = ((ValueAnimator) mArrowToLineAnimatorSet.getChildAnimations().get(i)) .getCurrentPlayTime(); } mArrowToLineAnimatorSet.cancel(); break; case ANIMATING_PROGRESS: for (int i = 0; i < mProgressAnimationSet.getChildAnimations().size(); i++) { tab[i] = ((ValueAnimator) mProgressAnimationSet.getChildAnimations().get(i)) .getCurrentPlayTime(); } mProgressAnimationSet.cancel(); break; case ANIMATING_ERROR: tab[0] = mErrorAnimation.getCurrentPlayTime(); mErrorAnimation.cancel(); break; case ANIMATING_SUCCESS: tab[0] = mSuccessAnimation.getCurrentPlayTime(); mSuccessAnimation.cancel(); break; } return tab; }
private void setTargetInternal(Object target, Animator animator) { if (animator instanceof AnimatorSet) { AnimatorSet set = ((AnimatorSet) animator); for (Animator child : set.getChildAnimations()) { setTargetInternal(target, child); } } else { animator.setTarget(target); } }