summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AppsCustomizePagedView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-10-05 18:14:31 -0700
committerAdam Cohen <adamcohen@google.com>2012-10-05 18:14:31 -0700
commitaaa5c21ee2e03def644fb6ba8eadbb59873ddd45 (patch)
treec592b21457aaea1a37c3790dff5eecc850365d63 /src/com/android/launcher2/AppsCustomizePagedView.java
parent28b3e10fdea4d719b46d2e0da9a916bacc238fd1 (diff)
downloadandroid_packages_apps_Trebuchet-aaa5c21ee2e03def644fb6ba8eadbb59873ddd45.tar.gz
android_packages_apps_Trebuchet-aaa5c21ee2e03def644fb6ba8eadbb59873ddd45.tar.bz2
android_packages_apps_Trebuchet-aaa5c21ee2e03def644fb6ba8eadbb59873ddd45.zip
Fix to ensure default widgets get size callbacks (issue 7287744)
Change-Id: I46b329db247a0b450493530ab619576c45418b01
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 609bb6d09..b71726165 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -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;
}