@Override public void onResume() { super.onResume(); // load animations mAnimVcardOut = AnimatorInflater.loadAnimator(this, R.animator.fade_out); mAnimVerticalLeftIn = AnimatorInflater.loadAnimator(this, R.animator.fade_in); mAnimVerticalRightIn = AnimatorInflater.loadAnimator(this, R.animator.fade_in); mAnimVcardOut.addListener(new HideAfterAnimatorListener(mContainerVcard)); mAnimVerticalLeftIn.addListener(new DisplayBeforeAnimatorListener(mVerticalLeft)); mAnimVerticalRightIn.addListener(new DisplayBeforeAnimatorListener(mVerticalRight)); if (!mPrefs.getBoolean(Constants.PREF_SIDE_USED, false)) { final Animator animatorHintLeft = AnimatorInflater.loadAnimator(this, R.animator.side_hint); final Animator animatorHintRight = AnimatorInflater.loadAnimator(this, R.animator.side_hint); animatorHintLeft.addListener(new BothEndsAnimatorListener(mHintLeft)); animatorHintRight.addListener(new BothEndsAnimatorListener(mHintRight)); animatorHintLeft.setTarget(mHintLeft); animatorHintRight.setTarget(mHintRight); animatorHintLeft.start(); animatorHintRight.start(); } }
@Override public void start() { Animator a = mAnimator.get(); if (a != null) { a.start(); } }
/** * Animates all the cards displayed out of the screen. The total skipped classes text view and the * add subject button will also be animated to a 0 alpha. * * @return the estimated duration of the whole animation */ private long animateClearAll() { final long betweenCardsDelay = 80; int size = mSubjectCards.size(); for (int i = 0; i < size; i++) mSubjectCards.get(i).swipeRight(0, betweenCardsDelay * i); long halfDuration = (betweenCardsDelay * size) / 2 + 120; Animator anmtr = AnimatorCreationUtil.ofFloat(mAddButton, "alpha", halfDuration, null, 0); anmtr.setStartDelay(halfDuration); anmtr.start(); anmtr = AnimatorCreationUtil.ofFloat(mTotalAbsencesTextView, "alpha", halfDuration, null, 0); anmtr.setStartDelay(halfDuration); anmtr.start(); return 2 * halfDuration; }
@Override public void start() { super.start(); Animator a = mAnimator.get(); if (a != null) a.start(); }
public void startAnimation() { createAnimation(); animation.start(); }