diff options
author | Michael Jurka <mikejurka@google.com> | 2010-10-08 16:58:12 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-10-08 16:58:12 -0700 |
commit | 9987a5c45e7d01a780d73b269bdce8d8a5309219 (patch) | |
tree | 2c4d5b331bb311df92a8c3107ea7b5a4ba92fe80 /src/com/android | |
parent | 4516c11039d77066281f69f9b5d30fdaf1bc05ae (diff) | |
download | android_packages_apps_Trebuchet-9987a5c45e7d01a780d73b269bdce8d8a5309219.tar.gz android_packages_apps_Trebuchet-9987a5c45e7d01a780d73b269bdce8d8a5309219.tar.bz2 android_packages_apps_Trebuchet-9987a5c45e7d01a780d73b269bdce8d8a5309219.zip |
Fixed 3066306 Widget measurement wrong in customize tray
Diffstat (limited to 'src/com/android')
-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); |