diff options
author | Adam Cohen <adamcohen@google.com> | 2012-05-09 11:28:04 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-09 11:28:04 -0700 |
commit | 3e8582d71f1014477571e7e2b05185e18defe8ef (patch) | |
tree | 9da7d90287e1152410630dba5560f7c6447f68b1 | |
parent | f60ae4e36195e3d001016da1ed08ecbb7adb3202 (diff) | |
parent | 88f295d72b6228738a9ea7eaa0a3b8796a1ff918 (diff) | |
download | frameworks_base-3e8582d71f1014477571e7e2b05185e18defe8ef.zip frameworks_base-3e8582d71f1014477571e7e2b05185e18defe8ef.tar.gz frameworks_base-3e8582d71f1014477571e7e2b05185e18defe8ef.tar.bz2 |
am 88f295d7: am 6a080bff: Merge "Accounting for widget padding in dips instead of pixels" into jb-dev
* commit '88f295d72b6228738a9ea7eaa0a3b8796a1ff918':
Accounting for widget padding in dips instead of pixels
-rw-r--r-- | core/java/android/appwidget/AppWidgetHostView.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java index 2ca2ae4..01b68d4 100644 --- a/core/java/android/appwidget/AppWidgetHostView.java +++ b/core/java/android/appwidget/AppWidgetHostView.java @@ -232,14 +232,15 @@ public class AppWidgetHostView extends FrameLayout { if (mInfo != null) { padding = getDefaultPaddingForWidget(mContext, mInfo.provider, padding); } + float density = getResources().getDisplayMetrics().density; - int xPadding = padding.left + padding.right; - int yPadding = padding.top + padding.bottom; + int xPaddingDips = (int) ((padding.left + padding.right) / density); + int yPaddingDips = (int) ((padding.top + padding.bottom) / density); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth - xPadding); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight - yPadding); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth - xPadding); - options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, maxHeight - yPadding); + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth - xPaddingDips); + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight - yPaddingDips); + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth - xPaddingDips); + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, maxHeight - yPaddingDips); updateAppWidgetOptions(options); } |