diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 164d7c5dd..13603f0b4 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -1110,9 +1110,12 @@ public class CellLayout extends ViewGroup implements Dimmable { * @param result An array of length 2 in which to store the result (may be null). */ public int[] rectToCell(int width, int height, int[] result) { + return rectToCell(getResources(), width, height, result); + } + + public static int[] rectToCell(Resources resources, int width, int height, int[] result) { // Always assume we're working with the smallest span to make sure we // reserve enough space in both orientations. - final Resources resources = getResources(); int actualWidth = resources.getDimensionPixelSize(R.dimen.workspace_cell_width); int actualHeight = resources.getDimensionPixelSize(R.dimen.workspace_cell_height); int smallerSize = Math.min(actualWidth, actualHeight); diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index b7e5dcd2d..f3de74b36 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -624,8 +624,10 @@ public class CustomizePagedView extends PagedView l.setOnLongClickListener(this); final Drawable icon = getWidgetIcon(info); - final int hSpan = mWorkspaceWidgetLayout.estimateCellHSpan(info.minWidth); - final int vSpan = mWorkspaceWidgetLayout.estimateCellHSpan(info.minHeight); + + int[] spans = CellLayout.rectToCell(getResources(), info.minWidth, info.minHeight, null); + final int hSpan = spans[0]; + final int vSpan = spans[1]; ImageView image = (ImageView) l.findViewById(R.id.widget_preview); image.setMaxWidth(mMaxWidgetWidth); |