summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher2/CellLayout.java2
-rw-r--r--src/com/android/launcher2/PagedViewWidget.java4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index c2797be35..1223d1c35 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1746,6 +1746,8 @@ public class CellLayout extends ViewGroup {
private boolean rearrangementExists(int cellX, int cellY, int spanX, int spanY, int[] direction,
View ignoreView, ItemConfiguration solution) {
+ // Return early if get invalid cell positions
+ if (cellX < 0 || cellY < 0) return false;
mIntersectingViews.clear();
mOccupiedRect.set(cellX, cellY, cellX + spanX, cellY + spanY);
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 670717e49..774bf1f2c 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -92,7 +92,9 @@ public class PagedViewWidget extends LinearLayout {
name.setText(info.label);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
if (dims != null) {
- dims.setText(String.format(mDimensionsFormatString, cellSpan[0], cellSpan[1]));
+ int hSpan = Math.min(cellSpan[0], LauncherModel.getCellCountX());
+ int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY());
+ dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
}
}