diff options
author | Adam Cohen <adamcohen@google.com> | 2011-07-14 16:10:03 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-07-14 16:11:03 -0700 |
commit | 093538671bdbce2629dd0bf788e5d3489514631e (patch) | |
tree | 8eaf3c4090c5c9f4cdf0c8b2c5286fad62a5ffd4 | |
parent | f2253e14468c600e348c95f8be37f8267d28d4e8 (diff) | |
download | android_packages_apps_Trebuchet-093538671bdbce2629dd0bf788e5d3489514631e.tar.gz android_packages_apps_Trebuchet-093538671bdbce2629dd0bf788e5d3489514631e.tar.bz2 android_packages_apps_Trebuchet-093538671bdbce2629dd0bf788e5d3489514631e.zip |
Ensuring that we give a widget the full space requested
Change-Id: I03ca7be47e427373f1efdad3f97d18db9bd3b913
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index b26e3ac63..489f3fbb8 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1048,7 +1048,17 @@ public final class Launcher extends Activity // Calculate the grid spans needed to fit this widget CellLayout layout = (CellLayout) mWorkspace.getChildAt(screen); - int[] spanXY = layout.rectToCell(appWidgetInfo.minWidth, appWidgetInfo.minHeight, null); + + // We want to account for the extra amount of padding that we are adding to the widget + // to ensure that it gets the full amount of space that it has requested + Resources r = getResources(); + int requiredWidth = appWidgetInfo.minWidth + + r.getDimensionPixelSize(R.dimen.app_widget_padding_left) + + r.getDimensionPixelSize(R.dimen.app_widget_padding_right); + int requiredHeight = appWidgetInfo.minHeight + + r.getDimensionPixelSize(R.dimen.app_widget_padding_top) + + r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom); + int[] spanXY = layout.rectToCell(requiredWidth, requiredHeight, null); // Try finding open space on Launcher screen // We have saved the position to which the widget was dragged-- this really only matters |