/** * 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; }
public void updateTotal() { mTotalWeeklyClasses = 0; mTotalDelays = 0; for (SubjectCard materia : mSubjectCards) { mTotalWeeklyClasses += materia.getData().getWeeklyClasses(); mTotalDelays += materia.getData().getDelays(); } if ((int) (2 * Math.ceil((float) 0.10f * 16 * mTotalWeeklyClasses)) - mTotalDelays <= 0.2f * (int) Math.ceil((float) 0.10f * 16 * mTotalWeeklyClasses)) { if (mTotalAbsencesTextView.getCurrentTextColor() != Color.RED) { AnimatorCreationUtil.ofTextColor(mTotalAbsencesTextView, 300, Color.RED).start(); } } else if (mTotalAbsencesTextView.getCurrentTextColor() != Color.DKGRAY) { AnimatorCreationUtil.ofTextColor(mTotalAbsencesTextView, 300, Color.DKGRAY).start(); } mTotalAbsencesTextView.setText( "Total: " + (float) mTotalDelays / 2 + "/" + ((int) Math.ceil((float) 0.10f * 16 * mTotalWeeklyClasses))); }