Don't animate tapped item if the target screen is full
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index ef4637e..505d465 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -909,19 +909,6 @@
}
/**
- * Estimate the size that a child with the given dimensions will take in the layout.
- */
- void estimateChildSize(int minWidth, int minHeight, int[] result) {
- // Assuming it's placed at 0, 0, find where the bottom right cell will land
- rectToCell(minWidth, minHeight, result);
-
- // Then figure out the rect it will occupy
- cellToRect(0, 0, result[0], result[1], mRectF);
- result[0] = (int)mRectF.width();
- result[1] = (int)mRectF.height();
- }
-
- /**
* Estimate where the top left cell of the dragged item will land if it is dropped.
*
* @param originX The X value of the top left corner of the item
@@ -1322,6 +1309,29 @@
}
/**
+ * Calculate the grid spans needed to fit given item
+ */
+ public void calculateSpans(ItemInfo info) {
+ final int minWidth;
+ final int minHeight;
+
+ if (info instanceof LauncherAppWidgetInfo) {
+ minWidth = ((LauncherAppWidgetInfo) info).minWidth;
+ minHeight = ((LauncherAppWidgetInfo) info).minHeight;
+ } else if (info instanceof PendingAddWidgetInfo) {
+ minWidth = ((PendingAddWidgetInfo) info).minWidth;
+ minHeight = ((PendingAddWidgetInfo) info).minHeight;
+ } else {
+ // It's not a widget, so it must be 1x1
+ info.spanX = info.spanY = 1;
+ return;
+ }
+ int[] spans = rectToCell(minWidth, minHeight, null);
+ info.spanX = spans[0];
+ info.spanY = spans[1];
+ }
+
+ /**
* Find the first vacant cell, if there is one.
*
* @param vacant Holds the x and y coordinate of the vacant cell