Fix to ensure default widgets get size callbacks (issue 7287744)

Change-Id: I46b329db247a0b450493530ab619576c45418b01
This commit is contained in:
Adam Cohen
2012-10-05 18:14:31 -07:00
parent 28b3e10fde
commit aaa5c21ee2
4 changed files with 21 additions and 14 deletions
@@ -617,11 +617,22 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
Bundle options = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, mTmpRect);
Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(mLauncher,
info.componentName, null);
float density = getResources().getDisplayMetrics().density;
int xPaddingDips = (int) ((padding.left + padding.right) / density);
int yPaddingDips = (int) ((padding.top + padding.bottom) / density);
options = new Bundle();
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, mTmpRect.left);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, mTmpRect.top);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, mTmpRect.right);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, mTmpRect.bottom);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
mTmpRect.left - xPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
mTmpRect.top - yPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
mTmpRect.right - xPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
mTmpRect.bottom - yPaddingDips);
}
return options;
}