summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-08-03 14:40:11 -0700
committerWinson <winsonc@google.com>2015-08-05 12:04:06 -0700
commit006ee269ba2e9946a83b42f96d4a0296254cba4a (patch)
treecd36c7d5290b2ddcb51fdd120d78b6f6a4228296 /src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
parent153b02a5e69c99b1154eea107da6b2fba4c6f3a3 (diff)
downloadandroid_packages_apps_Trebuchet-006ee269ba2e9946a83b42f96d4a0296254cba4a.tar.gz
android_packages_apps_Trebuchet-006ee269ba2e9946a83b42f96d4a0296254cba4a.tar.bz2
android_packages_apps_Trebuchet-006ee269ba2e9946a83b42f96d4a0296254cba4a.zip
Refactoring search bar animations.
- This refactoring ensures that LauncherStateTransition does not do its own animation on the QSB, and that all animations to the SearchDropTargetBar go through its own animators. Bug: 22515084 Change-Id: Ia7d13c44d861eac7517076b52a9651a90911ed0a
Diffstat (limited to 'src/com/android/launcher3/WorkspaceStateTransitionAnimation.java')
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java77
1 files changed, 4 insertions, 73 deletions
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index e908ccd81..54f63bbd8 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -218,16 +218,13 @@ public class WorkspaceStateTransitionAnimation {
}
public AnimatorSet getAnimationToState(Workspace.State fromState, Workspace.State toState,
- int toPage, boolean animated, boolean hasOverlaySearchBar,
- HashMap<View, Integer> layerViews) {
+ int toPage, boolean animated, HashMap<View, Integer> layerViews) {
AccessibilityManager am = (AccessibilityManager)
mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
final boolean accessibilityEnabled = am.isEnabled();
TransitionStates states = new TransitionStates(fromState, toState);
- int duration = getAnimationDuration(states);
- animateWorkspace(states, toPage, animated, duration, layerViews,
- accessibilityEnabled);
- animateSearchBar(states, animated, duration, hasOverlaySearchBar, layerViews,
+ int workspaceDuration = getAnimationDuration(states);
+ animateWorkspace(states, toPage, animated, workspaceDuration, layerViews,
accessibilityEnabled);
animateBackgroundGradient(states, animated, BACKGROUND_FADE_OUT_DURATION);
return mStateAnimator;
@@ -474,75 +471,9 @@ public class WorkspaceStateTransitionAnimation {
}
/**
- * Coordinates with the workspace animation to animate the search bar.
- *
- * TODO: This should really be coordinated with the SearchDropTargetBar, otherwise the
- * bar has no idea that it is hidden, and this has no idea what state the bar is
- * actually in.
- */
- private void animateSearchBar(TransitionStates states, boolean animated, int duration,
- boolean hasOverlaySearchBar, final HashMap<View, Integer> layerViews,
- final boolean accessibilityEnabled) {
-
- // The search bar is only visible in the workspace
- final View searchBar = mLauncher.getOrCreateQsbBar();
- if (searchBar != null) {
- final boolean searchBarWillBeShown = states.stateIsNormal;
- final float finalSearchBarAlpha = searchBarWillBeShown ? 1f : 0f;
- if (animated) {
- if (hasOverlaySearchBar) {
- // If there is an overlay search bar, then we will coordinate with it.
- mStateAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- // If we are transitioning to a visible search bar, show it immediately
- // and let the overlay search bar has faded out
- if (searchBarWillBeShown) {
- searchBar.setAlpha(finalSearchBarAlpha);
- AlphaUpdateListener.updateVisibility(searchBar, accessibilityEnabled);
- }
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- // If we are transitioning to a hidden search bar, hide it only after
- // the overlay search bar has faded in
- if (!searchBarWillBeShown) {
- searchBar.setAlpha(finalSearchBarAlpha);
- AlphaUpdateListener.updateVisibility(searchBar, accessibilityEnabled);
- }
- }
- });
- } else {
- // Otherwise, we can just do the normal animation
- LauncherViewPropertyAnimator searchBarAlpha =
- new LauncherViewPropertyAnimator(searchBar).alpha(finalSearchBarAlpha);
- searchBarAlpha.addListener(new AlphaUpdateListener(searchBar,
- accessibilityEnabled));
- searchBar.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- if (layerViews != null) {
- // If layerViews is not null, we add these views, and indicate that
- // the caller can manage layer state.
- layerViews.put(searchBar, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
- } else {
- // Otherwise let the animator handle layer management.
- searchBarAlpha.withLayer();
- }
- searchBarAlpha.setDuration(duration);
- mStateAnimator.play(searchBarAlpha);
- }
- } else {
- // Set the search bar state immediately
- searchBar.setAlpha(finalSearchBarAlpha);
- AlphaUpdateListener.updateVisibility(searchBar, accessibilityEnabled);
- }
- }
- }
-
- /**
* Animates the background scrim. Add to the state animator to prevent jankiness.
*
- * @param finalAlpha the final alpha for the background scrim
+ * @param states the current and final workspace states
* @param animated whether or not to set the background alpha immediately
* @duration duration of the animation
*/