Merge "Making padding a little smaller in portrait to accommodate larger spanish tab text. (3393521)" into honeycomb
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c4aa26..6dcaa57 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -54,7 +54,7 @@
     <!--  Title of tab for configuring wallpapers -->
     <string name="wallpapers_tab_label">Wallpapers</string>
     <!--  Title of tab for configuring applications -->
-    <string name="applications_tab_label">App Shortcuts</string>
+    <string name="applications_tab_label">App shortcuts</string>
     <!--  Placeholder text, will be removed -->
     <string name="wallpapers_temp_tab_text">This will be the wallpapers tab</string>
     <!--  Labels for the tabs in All Apps -->
@@ -65,7 +65,7 @@
     <!--  Title of the tab for applications labeled as games [CHAR_LIMIT=24] -->
     <string name="all_apps_tab_games">Games</string>
     <!--  Tile of the tab for applications that were downloaded from market [CHAR_LIMIT=24] -->
-    <string name="all_apps_tab_downloaded">My Apps</string>
+    <string name="all_apps_tab_downloaded">My apps</string>
 
     <!-- All Apps pane -->
     <!-- Message to show when there are no games [CHAR_LIMIT=25] -->
diff --git a/src/com/android/launcher2/SpringLoadedDragController.java b/src/com/android/launcher2/SpringLoadedDragController.java
index a734258..9007581 100644
--- a/src/com/android/launcher2/SpringLoadedDragController.java
+++ b/src/com/android/launcher2/SpringLoadedDragController.java
@@ -26,6 +26,8 @@
     // the screen the user is currently hovering over, if any
     private CellLayout mScreen;
     private Launcher mLauncher;
+    boolean mFinishedAnimation = false;
+    boolean mWaitingToReenter = false;
 
     public SpringLoadedDragController(Launcher launcher) {
         mLauncher = launcher;
@@ -33,9 +35,16 @@
         mAlarm.setOnAlarmListener(this);
     }
 
-    public void onDragEnter(CellLayout cl) {
+    public void onDragEnter(CellLayout cl, boolean isSpringLoaded) {
         mScreen = cl;
         mAlarm.setAlarm(ENTER_SPRING_LOAD_HOVER_TIME);
+        mFinishedAnimation = isSpringLoaded;
+        mWaitingToReenter = false;
+    }
+
+    public void onEnterSpringLoadedMode(boolean waitToReenter) {
+        mFinishedAnimation = true;
+        mWaitingToReenter = waitToReenter;
     }
 
     public void onDragExit() {
@@ -43,7 +52,9 @@
             mScreen.onDragExit();
         }
         mScreen = null;
-        mAlarm.setAlarm(EXIT_SPRING_LOAD_HOVER_TIME);
+        if (mFinishedAnimation && !mWaitingToReenter) {
+            mAlarm.setAlarm(EXIT_SPRING_LOAD_HOVER_TIME);
+        }
     }
 
     // this is called when our timer runs out
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 270027b..842f2f3 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -209,6 +209,13 @@
     boolean mUpdateWallpaperOffsetImmediately = false;
     boolean mSyncWallpaperOffsetWithScroll = true;
 
+    // info about the last drag
+    private DragView mLastDragView;
+    private int mLastDragOriginX;
+    private int mLastDragOriginY;
+    private int mLastDragXOffset;
+    private int mLastDragYOffset;
+
     /**
      * Used to inflate the Workspace from XML.
      *
@@ -275,11 +282,19 @@
                 mIsInUnshrinkAnimation = true;
                 disableCacheUpdates();
             }
+
             @Override
             public void onAnimationEnd(Animator animation) {
                 mIsInUnshrinkAnimation = false;
                 mSyncWallpaperOffsetWithScroll = true;
-                if (mShrinkState != ShrinkState.SPRING_LOADED) {
+                if (mShrinkState == ShrinkState.SPRING_LOADED) {
+                    View layout = null;
+                    if (mLastDragView != null) {
+                        layout = findMatchingPageForDragOver(mLastDragView, mLastDragOriginX,
+                                mLastDragOriginY, mLastDragXOffset, mLastDragYOffset);
+                    }
+                    mSpringLoadedDragController.onEnterSpringLoadedMode(layout == null);
+                } else {
                     mDrawCustomizeTrayBackground = false;
                 }
                 enableCacheUpdates();
@@ -1499,6 +1514,7 @@
     // we call this method whenever a drag and drop in Launcher finishes, even if Workspace was
     // never dragged over
     public void onDragStopped(boolean success) {
+        mLastDragView = null;
         // In the success case, DragController has already called onDragExit()
         if (!success) {
             doDragExit();
@@ -2338,8 +2354,12 @@
             int originY = y - yOffset;
             boolean shrunken = mIsSmall || mIsInUnshrinkAnimation;
             if (shrunken) {
-                layout = findMatchingPageForDragOver(
-                        dragView, originX, originY, xOffset, yOffset);
+                mLastDragView = dragView;
+                mLastDragOriginX = originX;
+                mLastDragOriginY = originY;
+                mLastDragXOffset = xOffset;
+                mLastDragYOffset = yOffset;
+                layout = findMatchingPageForDragOver(dragView, originX, originY, xOffset, yOffset);
 
                 if (layout != mDragTargetLayout) {
                     if (mDragTargetLayout != null) {
@@ -2349,7 +2369,8 @@
                     mDragTargetLayout = layout;
                     if (mDragTargetLayout != null && mDragTargetLayout.getAcceptsDrops()) {
                         mDragTargetLayout.setIsDragOverlapping(true);
-                        mSpringLoadedDragController.onDragEnter(mDragTargetLayout);
+                        mSpringLoadedDragController.onDragEnter(
+                                mDragTargetLayout, mShrinkState == ShrinkState.SPRING_LOADED);
                     }
                 }
             } else {