am cf068ba2: am 3ae8bf53: Merge "Change FloatingToolbar entry/exit animations to fadeIn/fadeOut." into mnc-dev

* commit 'cf068ba27d86289ed085da17a0536a4d3a5208e6':
  Change FloatingToolbar entry/exit animations to fadeIn/fadeOut.
This commit is contained in:
Abodunrinwa Toki
2015-06-10 23:14:21 +00:00
committed by Android Git Automerger

View File

@@ -361,7 +361,7 @@ public final class FloatingToolbar {
mParent = Preconditions.checkNotNull(parent); mParent = Preconditions.checkNotNull(parent);
mContentContainer = createContentContainer(parent.getContext()); mContentContainer = createContentContainer(parent.getContext());
mPopupWindow = createPopupWindow(mContentContainer); mPopupWindow = createPopupWindow(mContentContainer);
mDismissAnimation = createShrinkFadeOutFromBottomAnimation( mDismissAnimation = createExitAnimation(
mContentContainer, mContentContainer,
150, // startDelay 150, // startDelay
new AnimatorListenerAdapter() { new AnimatorListenerAdapter() {
@@ -371,7 +371,7 @@ public final class FloatingToolbar {
mContentContainer.removeAllViews(); mContentContainer.removeAllViews();
} }
}); });
mHideAnimation = createShrinkFadeOutFromBottomAnimation( mHideAnimation = createExitAnimation(
mContentContainer, mContentContainer,
0, // startDelay 0, // startDelay
new AnimatorListenerAdapter() { new AnimatorListenerAdapter() {
@@ -561,7 +561,7 @@ public final class FloatingToolbar {
* Performs the "show" animation on the floating popup. * Performs the "show" animation on the floating popup.
*/ */
private void runShowAnimation() { private void runShowAnimation() {
createGrowFadeInFromBottom(mContentContainer).start(); createEnterAnimation(mContentContainer).start();
} }
/** /**
@@ -1369,38 +1369,35 @@ public final class FloatingToolbar {
} }
/** /**
* Creates a "grow and fade in from the bottom" animation for the specified view. * Creates an "appear" animation for the specified view.
* *
* @param view The view to animate * @param view The view to animate
*/ */
private static AnimatorSet createGrowFadeInFromBottom(View view) { private static AnimatorSet createEnterAnimation(View view) {
AnimatorSet growFadeInFromBottomAnimation = new AnimatorSet(); AnimatorSet animation = new AnimatorSet();
growFadeInFromBottomAnimation.playTogether( animation.playTogether(
ObjectAnimator.ofFloat(view, View.SCALE_X, 0.5f, 1).setDuration(125), ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(200),
ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.5f, 1).setDuration(125),
ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(75),
// Make sure that view.x is always fixed throughout the duration of this animation. // Make sure that view.x is always fixed throughout the duration of this animation.
ObjectAnimator.ofFloat(view, View.X, view.getX(), view.getX())); ObjectAnimator.ofFloat(view, View.X, view.getX(), view.getX()));
growFadeInFromBottomAnimation.setStartDelay(50); animation.setStartDelay(50);
return growFadeInFromBottomAnimation; return animation;
} }
/** /**
* Creates a "shrink and fade out from bottom" animation for the specified view. * Creates a "disappear" animation for the specified view.
* *
* @param view The view to animate * @param view The view to animate
* @param startDelay The start delay of the animation * @param startDelay The start delay of the animation
* @param listener The animation listener * @param listener The animation listener
*/ */
private static AnimatorSet createShrinkFadeOutFromBottomAnimation( private static AnimatorSet createExitAnimation(
View view, int startDelay, Animator.AnimatorListener listener) { View view, int startDelay, Animator.AnimatorListener listener) {
AnimatorSet shrinkFadeOutFromBottomAnimation = new AnimatorSet(); AnimatorSet animation = new AnimatorSet();
shrinkFadeOutFromBottomAnimation.playTogether( animation.playTogether(
ObjectAnimator.ofFloat(view, View.SCALE_Y, 1, 0.5f).setDuration(125), ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0).setDuration(200));
ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0).setDuration(75)); animation.setStartDelay(startDelay);
shrinkFadeOutFromBottomAnimation.setStartDelay(startDelay); animation.addListener(listener);
shrinkFadeOutFromBottomAnimation.addListener(listener); return animation;
return shrinkFadeOutFromBottomAnimation;
} }
private static int getEstimatedToolbarHeight(Context context) { private static int getEstimatedToolbarHeight(Context context) {