summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Launcher.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-04-30 18:59:53 -0700
committerAdam Cohen <adamcohen@google.com>2012-04-30 18:59:53 -0700
commit2f093b6ad185967c129781526060288e983bc58a (patch)
tree2442e9894fa961e6ba61e375bab492448ed976b7 /src/com/android/launcher2/Launcher.java
parentaccf3bffedc736c04034bfee8e1a8e4fe775f568 (diff)
downloadandroid_packages_apps_Trebuchet-2f093b6ad185967c129781526060288e983bc58a.tar.gz
android_packages_apps_Trebuchet-2f093b6ad185967c129781526060288e983bc58a.tar.bz2
android_packages_apps_Trebuchet-2f093b6ad185967c129781526060288e983bc58a.zip
Fix widget resizes that shouldn't (issue 6380435)
Change-Id: Ia1da2df16ca184e6f451775597fa33ee38df6122
Diffstat (limited to 'src/com/android/launcher2/Launcher.java')
-rw-r--r--src/com/android/launcher2/Launcher.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index cb737ff69..3c20a5850 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1000,29 +1000,30 @@ public final class Launcher extends Activity
}
}
- int[] getSpanForWidget(ComponentName component, int minWidth, int minHeight) {
- Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(this, component, null);
+ static int[] getSpanForWidget(Context context, ComponentName component, int minWidth,
+ int minHeight) {
+ Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(context, component, 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
int requiredWidth = minWidth + padding.left + padding.right;
int requiredHeight = minHeight + padding.top + padding.bottom;
- return CellLayout.rectToCell(getResources(), requiredWidth, requiredHeight, null);
+ return CellLayout.rectToCell(context.getResources(), requiredWidth, requiredHeight, null);
}
- int[] getSpanForWidget(AppWidgetProviderInfo info) {
- return getSpanForWidget(info.provider, info.minWidth, info.minHeight);
+ static int[] getSpanForWidget(Context context, AppWidgetProviderInfo info) {
+ return getSpanForWidget(context, info.provider, info.minWidth, info.minHeight);
}
- int[] getMinSpanForWidget(AppWidgetProviderInfo info) {
- return getSpanForWidget(info.provider, info.minResizeWidth, info.minResizeHeight);
+ static int[] getMinSpanForWidget(Context context, AppWidgetProviderInfo info) {
+ return getSpanForWidget(context, info.provider, info.minResizeWidth, info.minResizeHeight);
}
- int[] getSpanForWidget(PendingAddWidgetInfo info) {
- return getSpanForWidget(info.componentName, info.minWidth, info.minHeight);
+ static int[] getSpanForWidget(Context context, PendingAddWidgetInfo info) {
+ return getSpanForWidget(context, info.componentName, info.minWidth, info.minHeight);
}
- int[] getMinSpanForWidget(PendingAddWidgetInfo info) {
- return getSpanForWidget(info.componentName, info.minResizeWidth,
+ static int[] getMinSpanForWidget(Context context, PendingAddWidgetInfo info) {
+ return getSpanForWidget(context, info.componentName, info.minResizeWidth,
info.minResizeHeight);
}
@@ -1041,8 +1042,8 @@ public final class Launcher extends Activity
// Calculate the grid spans needed to fit this widget
CellLayout layout = getCellLayout(container, screen);
- int[] minSpanXY = getMinSpanForWidget(appWidgetInfo);
- int[] spanXY = getSpanForWidget(appWidgetInfo);
+ int[] minSpanXY = getMinSpanForWidget(this, appWidgetInfo);
+ int[] spanXY = getSpanForWidget(this, appWidgetInfo);
// Try finding open space on Launcher screen
// We have saved the position to which the widget was dragged-- this really only matters