Animate Folder elevation halfway thru transition.
am: c7aa37d696
Change-Id: Iafc6757fbb9dd85a7cd52f39c8178ab5a741326e
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 7adda19..3648c60 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -201,20 +201,20 @@
play(a, new RoundedRectRevealOutlineProvider(initialRadius, finalRadius, startRect,
endRect).createRevealAnimator(mFolder, !mIsOpening));
+ // Animate the elevation midway so that the shadow is not noticeable in the background.
+ int midDuration = mDuration / 2;
+ Animator z = getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0);
+ play(a, z, midDuration, midDuration);
+
a.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mFolder.setTranslationX(0.0f);
mFolder.setTranslationY(0.0f);
+ mFolder.setTranslationZ(0.0f);
mFolder.setScaleX(1f);
mFolder.setScaleY(1f);
-
- if (mIsOpening) {
- getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0)
- .setDuration(150)
- .start();
- }
}
});
@@ -323,7 +323,12 @@
}
private void play(AnimatorSet as, Animator a) {
- a.setDuration(mDuration);
+ play(as, a, a.getStartDelay(), mDuration);
+ }
+
+ private void play(AnimatorSet as, Animator a, long startDelay, int duration) {
+ a.setStartDelay(startDelay);
+ a.setDuration(duration);
as.play(a);
}