Hide the floating toolbar faster.

There's a delay in the toolbar dismiss animation to allow for touch
feedback ripples to be visible. This is not necessary when hiding
the toolbar. This CL removes the delay for hide animation.

Change-Id: Ic665f717200cad863327ef495e416c99aafb2dea
This commit is contained in:
Abodunrinwa Toki
2015-05-06 18:35:41 +01:00
parent 0fb5aa656e
commit cdffaa4c5a

View File

@@ -378,6 +378,7 @@ public final class FloatingToolbar {
mShowAnimation = createGrowFadeInFromBottom(mContentContainer);
mDismissAnimation = createShrinkFadeOutFromBottomAnimation(
mContentContainer,
0,
new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -387,6 +388,7 @@ public final class FloatingToolbar {
});
mHideAnimation = createShrinkFadeOutFromBottomAnimation(
mContentContainer,
150,
new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -1224,15 +1226,16 @@ public final class FloatingToolbar {
* Creates a "shrink and fade out from bottom" animation for the specified view.
*
* @param view The view to animate
* @param startDelay The start delay of the animation
* @param listener The animation listener
*/
private static AnimatorSet createShrinkFadeOutFromBottomAnimation(
View view, Animator.AnimatorListener listener) {
View view, int startDelay, Animator.AnimatorListener listener) {
AnimatorSet shrinkFadeOutFromBottomAnimation = new AnimatorSet();
shrinkFadeOutFromBottomAnimation.playTogether(
ObjectAnimator.ofFloat(view, View.SCALE_Y, 1, 0.5f).setDuration(125),
ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0).setDuration(75));
shrinkFadeOutFromBottomAnimation.setStartDelay(150);
shrinkFadeOutFromBottomAnimation.setStartDelay(startDelay);
shrinkFadeOutFromBottomAnimation.addListener(listener);
return shrinkFadeOutFromBottomAnimation;
}