Merge "Fixing small folder bugs"
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index aebfcb5..37368b9 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -743,6 +743,12 @@
 
         int left = Math.min(Math.max(0, centeredLeft), parentWidth - width);
         int top = Math.min(Math.max(0, centeredTop), parentHeight - height);
+        if (width >= parentWidth) {
+            left = (parentWidth - width) / 2;
+        }
+        if (height >= parentHeight) {
+            top = (parentHeight - height) / 2;
+        }
 
         int folderPivotX = width / 2 + (centeredLeft - left);
         int folderPivotY = height / 2 + (centeredTop - top);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 1059743..5ba9fd7 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1963,8 +1963,7 @@
         v.getDrawingRect(clipRect);
 
         // For a TextView, adjust the clip rect so that we don't include the text label
-        if (v instanceof FolderIcon) {
-        } else if (v instanceof BubbleTextView) {
+        if (v instanceof BubbleTextView) {
             final BubbleTextView tv = (BubbleTextView) v;
             clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V +
                     tv.getLayout().getLineTop(0);
@@ -1972,6 +1971,8 @@
             final TextView tv = (TextView) v;
             clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() +
                     tv.getLayout().getLineTop(0);
+        } else if (v instanceof FolderIcon) {
+            clipRect.bottom = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
         }
 
         // Draw the View into the bitmap.
@@ -2101,13 +2102,16 @@
         final int screenY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
 
         Rect dragRect = null;
-        if ((child instanceof BubbleTextView) && !(child instanceof FolderIcon)) {
+        if (child instanceof BubbleTextView) {
             int iconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
             int top = child.getPaddingTop();
             int left = (bmpWidth - iconSize) / 2;
             int right = left + iconSize;
             int bottom = top + iconSize;
             dragRect = new Rect(left, top, right, bottom);
+        } else if (child instanceof FolderIcon) {
+            int previewSize = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
+            dragRect = new Rect(0, 0, child.getWidth(), previewSize);
         }
 
         mLauncher.lockScreenOrientation();