Updating search bar animation, and adding use of hw layers.

Change-Id: Ida06bb526876abc793366415df1e06f483f3b66c
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 2e7caff..84fb9d0 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2368,6 +2368,9 @@
                     if (!animationCancelled) {
                         updateWallpaperVisibility(false);
                     }
+
+                    // Hide the search bar
+                    mSearchDropTargetBar.hideSearchBar(false);
                 }
 
                 @Override
@@ -2436,6 +2439,9 @@
                 // Hide the workspace scrollbar
                 mWorkspace.hideScrollingIndicator(true);
                 hideDockDivider();
+
+                // Hide the search bar
+                mSearchDropTargetBar.hideSearchBar(false);
             }
             dispatchOnLauncherTransitionPrepare(fromView, animated, false);
             dispatchOnLauncherTransitionStart(fromView, animated, false);
@@ -2569,13 +2575,16 @@
 
     void showWorkspace(boolean animated, Runnable onCompleteRunnable) {
         if (mState != State.WORKSPACE) {
+            boolean wasInSpringLoadedMode = (mState == State.APPS_CUSTOMIZE_SPRING_LOADED);
             mWorkspace.setVisibility(View.VISIBLE);
             hideAppsCustomizeHelper(State.WORKSPACE, animated, false, onCompleteRunnable);
 
-            // Show the search bar and hotseat
-            mSearchDropTargetBar.showSearchBar(animated);
+            // Show the search bar (only animate if we were showing the drop target bar in spring
+            // loaded mode)
+            mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
+
             // We only need to animate in the dock divider if we're going from spring loaded mode
-            showDockDivider(animated && mState == State.APPS_CUSTOMIZE_SPRING_LOADED);
+            showDockDivider(animated && wasInSpringLoadedMode);
 
             // Set focus to the AppsCustomize button
             if (mAllAppsButton != null) {
@@ -2602,9 +2611,6 @@
         showAppsCustomizeHelper(animated, false);
         mAppsCustomizeTabHost.requestFocus();
 
-        // Hide the search bar and hotseat
-        mSearchDropTargetBar.hideSearchBar(animated);
-
         // Change the state *after* we've called all the transition code
         mState = State.APPS_CUSTOMIZE;
 
@@ -2637,7 +2643,6 @@
                     // exitSpringLoadedDragMode made it visible. This is a bit hacky; we should
                     // clean up our state transition functions
                     mAppsCustomizeTabHost.setVisibility(View.GONE);
-                    mSearchDropTargetBar.showSearchBar(true);
                     showWorkspace(true, onCompleteRunnable);
                 } else {
                     exitSpringLoadedDragMode();