diff options
author | Tony Wickham <twickham@google.com> | 2015-10-12 16:15:51 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2015-10-12 17:36:22 -0700 |
commit | 685726b504d8bff913d0a51860bbda9142f7aeb5 (patch) | |
tree | 7bd45c6913ff98e2a7362ccdfa1b6ead9f7ae4fd /src/com/android/launcher3/LauncherStateTransitionAnimation.java | |
parent | e906643c70ea73e3e506dd260a8ccc71c7c357bb (diff) | |
download | android_packages_apps_Trebuchet-685726b504d8bff913d0a51860bbda9142f7aeb5.tar.gz android_packages_apps_Trebuchet-685726b504d8bff913d0a51860bbda9142f7aeb5.tar.bz2 android_packages_apps_Trebuchet-685726b504d8bff913d0a51860bbda9142f7aeb5.zip |
Play common transition animations from a common method.
There are 3 animations that 3 different transitions use; to prevent
future problems, let's put them all in one place. For instance,
ag/781127 added dispatchOnLauncherTransitionStepAnim() to the two
transitions that existed in burnaby-polish, but not to a third,
startAnimationToNewWorkspaceState(), that was added in master. If a
common method existed in polish, the new animation would have merged
into master automatically instead of forcing us to remember to add it.
Change-Id: I7775aaa43a08ae8b8241b0eeb77b6c84167c5ff0
Diffstat (limited to 'src/com/android/launcher3/LauncherStateTransitionAnimation.java')
-rw-r--r-- | src/com/android/launcher3/LauncherStateTransitionAnimation.java | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java index aa56f9db2..17dd6f3e1 100644 --- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java +++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java @@ -226,16 +226,8 @@ public class LauncherStateTransitionAnimation { // Cancel the current animation cancelAnimation(); - // Create the workspace animation. - // NOTE: this call apparently also sets the state for the workspace if !animated - Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState, - animated, layerViews); - - // Animate the search bar - startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState, - animated ? revealDuration : 0, overlaySearchBarView); - - Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView); + playCommonTransitionAnimations(fromWorkspaceState, toWorkspaceState, fromView, toView, + overlaySearchBarView, animated, initialized, animation, revealDuration, layerViews); if (animated && initialized) { // Setup the reveal view animation @@ -345,13 +337,6 @@ public class LauncherStateTransitionAnimation { }); - // Play the workspace animation - if (workspaceAnim != null) { - animation.play(workspaceAnim); - } - - animation.play(updateTransitionStepAnim); - // Dispatch the prepare transition signal dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionPrepare(toView, animated, false); @@ -411,6 +396,32 @@ public class LauncherStateTransitionAnimation { } /** + * Plays animations used by various transitions. + */ + private void playCommonTransitionAnimations(Workspace.State fromWorkspaceState, + Workspace.State toWorkspaceState, View fromView, View toView, View overlaySearchBarView, + boolean animated, boolean initialized, AnimatorSet animation, int revealDuration, + HashMap<View, Integer> layerViews) { + // Create the workspace animation. + // NOTE: this call apparently also sets the state for the workspace if !animated + Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState, + animated, layerViews); + + // Animate the search bar + startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState, + animated ? revealDuration : 0, overlaySearchBarView); + + if (animated && initialized) { + // Play the workspace animation + if (workspaceAnim != null) { + animation.play(workspaceAnim); + } + // Dispatch onLauncherTransitionStep() as the animation interpolates. + animation.play(dispatchOnLauncherTransitionStepAnim(fromView, toView)); + } + } + + /** * Returns an Animator that calls {@link #dispatchOnLauncherTransitionStep(View, float)} on * {@param fromView} and {@param toView} as the animation interpolates. * @@ -517,18 +528,10 @@ public class LauncherStateTransitionAnimation { // Cancel the current animation cancelAnimation(); - // Create the workspace animation. - // NOTE: this call apparently also sets the state for the workspace if !animated - Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState, - animated, layerViews); - - startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState, - animated ? revealDuration : 0, null); + playCommonTransitionAnimations(fromWorkspaceState, toWorkspaceState, fromWorkspace, null, + null, animated, animated, animation, revealDuration, layerViews); if (animated) { - if (workspaceAnim != null) { - animation.play(workspaceAnim); - } dispatchOnLauncherTransitionPrepare(fromWorkspace, animated, true); final AnimatorSet stateAnimation = animation; @@ -616,25 +619,10 @@ public class LauncherStateTransitionAnimation { // Cancel the current animation cancelAnimation(); - // Create the workspace animation. - // NOTE: this call apparently also sets the state for the workspace if !animated - Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState, - animated, layerViews); - - // Animate the search bar - startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState, - animated ? revealDuration : 0, overlaySearchBarView); - - Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView); + playCommonTransitionAnimations(fromWorkspaceState, toWorkspaceState, fromView, toView, + overlaySearchBarView, animated, initialized, animation, revealDuration, layerViews); if (animated && initialized) { - // Play the workspace animation - if (workspaceAnim != null) { - animation.play(workspaceAnim); - } - - animation.play(updateTransitionStepAnim); - // hideAppsCustomizeHelper is called in some cases when it is already hidden // don't perform all these no-op animations. In particularly, this was causing // the all-apps button to pop in and out. |