diff options
author | Yorke Lee <yorkelee@google.com> | 2014-08-27 22:54:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-27 22:54:15 +0000 |
commit | f0ab8dae956d9887a6582870c29f274b0157b4eb (patch) | |
tree | 3ed5be5ccb18ad9a0b64a58e2f9839a17e65c976 | |
parent | 03888112e34787243573eeaa6a0a1d47925fed71 (diff) | |
parent | 3f488a13d5a25dde877ac6d19bc97bdb1cb33ed4 (diff) |
Merge "Fix for blue screen of death" into lmp-dev
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index fcf179192..dd96d50d0 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -33,6 +33,7 @@ import android.text.TextUtils; import android.view.Display; import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnLayoutChangeListener; import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewPropertyAnimator; @@ -56,6 +57,7 @@ import java.util.List; public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPresenter.CallCardUi> implements CallCardPresenter.CallCardUi { + private AnimatorSet mAnimatorSet; private int mRevealAnimationDuration; private int mShrinkAnimationDuration; private int mFabNormalDiameter; @@ -917,22 +919,15 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr final Animator shrinkAnimator = getShrinkAnimator(parent.getHeight(), originalHeight); - final AnimatorSet set = new AnimatorSet(); - set.playSequentially(revealAnimator, shrinkAnimator); - set.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationCancel(Animator animation) { - mPrimaryCallCardContainer.removeOnLayoutChangeListener(listener); - mFloatingActionButtonController.scaleIn(); - } - + mAnimatorSet = new AnimatorSet(); + mAnimatorSet.playSequentially(revealAnimator, shrinkAnimator); + mAnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mPrimaryCallCardContainer.removeOnLayoutChangeListener(listener); - mFloatingActionButtonController.scaleIn(); + setViewStatePostAnimation(listener); } }); - set.start(); + mAnimatorSet.start(); } }); } @@ -959,6 +954,16 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mIsDialpadShowing ? mFabSmallDiameter : mFabNormalDiameter, true); } + @Override + public void onResume() { + super.onResume(); + // If the previous launch animation is still running, cancel it so that we don't get + // stuck in an intermediate animation state. + if (mAnimatorSet != null && mAnimatorSet.isRunning()) { + mAnimatorSet.cancel(); + } + } + /** * Adds a global layout listener to update the FAB's positioning on the next layout. This allows * us to position the FAB after the secondary call info's height has been calculated. @@ -1032,6 +1037,23 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr .setDuration(mShrinkAnimationDuration).setInterpolator(AnimUtils.EASE_IN); } + private void setViewStatePostAnimation(View view) { + view.setTranslationY(0); + view.setAlpha(1); + } + + private void setViewStatePostAnimation(OnLayoutChangeListener layoutChangeListener) { + setViewStatePostAnimation(mCallButtonsContainer); + setViewStatePostAnimation(mCallStateLabel); + setViewStatePostAnimation(mPrimaryName); + setViewStatePostAnimation(mCallTypeLabel); + setViewStatePostAnimation(mCallNumberAndLabel); + setViewStatePostAnimation(mCallStateIcon); + + mPrimaryCallCardContainer.removeOnLayoutChangeListener(layoutChangeListener); + mFloatingActionButtonController.scaleIn(); + } + private final class LayoutIgnoringListener implements View.OnLayoutChangeListener { @Override public void onLayoutChange(View v, |