Initial changes to restore clings.

Change-Id: Ie23e6e9f39679e8d35955a4a7db804d03f8b4d3f
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 47fc6c3..9ee3f64 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -453,6 +453,7 @@
                 Cling cling = mLauncher.showFirstRunFoldersCling();
                 if (cling != null) {
                     cling.bringToFront();
+                    bringToFront();
                 }
                 setFocusOnFirstChild();
             }
@@ -878,11 +879,13 @@
 
         float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
 
+        LauncherAppState app = LauncherAppState.getInstance();
+        DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
         int centerX = (int) (mTempRect.left + mTempRect.width() * scale / 2);
         int centerY = (int) (mTempRect.top + mTempRect.height() * scale / 2);
         int centeredLeft = centerX - width / 2;
         int centeredTop = centerY - height / 2;
-
         int currentPage = mLauncher.getWorkspace().getCurrentPage();
         // In case the workspace is scrolling, we need to use the final scroll to compute
         // the folders bounds.
@@ -900,8 +903,11 @@
                 bounds.left + bounds.width() - width);
         int top = Math.min(Math.max(bounds.top, centeredTop),
                 bounds.top + bounds.height() - height);
-        // If the folder doesn't fit within the bounds, center it about the desired bounds
-        if (width >= bounds.width()) {
+        if (grid.isPhone() && (grid.availableWidthPx - width) < grid.iconSizePx) {
+            // Center the folder if it is full (on phones only)
+            left = (grid.availableWidthPx - width) / 2;
+        } else if (width >= bounds.width()) {
+            // If the folder doesn't fit within the bounds, center it about the desired bounds
             left = bounds.left + (bounds.width() - width) / 2;
         }
         if (height >= bounds.height()) {