Merge "Use the current padding instead of the default one during layout." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-07-01 22:22:29 +00:00
committed by Android (Google) Code Review

View File

@@ -282,11 +282,10 @@ public class AppWidgetHostView extends FrameLayout {
} }
private SizeF computeSizeFromLayout(int left, int top, int right, int bottom) { private SizeF computeSizeFromLayout(int left, int top, int right, int bottom) {
Rect padding = getDefaultPadding();
float density = getResources().getDisplayMetrics().density; float density = getResources().getDisplayMetrics().density;
return new SizeF( return new SizeF(
(right - left - padding.right - padding.left) / density, (right - left - getPaddingLeft() - getPaddingRight()) / density,
(bottom - top - padding.bottom - padding.top) / density (bottom - top - getPaddingTop() - getPaddingBottom()) / density
); );
} }
@@ -386,7 +385,7 @@ public class AppWidgetHostView extends FrameLayout {
maxHeight = Math.max(maxHeight, paddedSize.getHeight()); maxHeight = Math.max(maxHeight, paddedSize.getHeight());
} }
if (paddedSizes.equals( if (paddedSizes.equals(
widgetManager.getAppWidgetOptions(mAppWidgetId).<PointF>getParcelableArrayList( widgetManager.getAppWidgetOptions(mAppWidgetId).<SizeF>getParcelableArrayList(
AppWidgetManager.OPTION_APPWIDGET_SIZES))) { AppWidgetManager.OPTION_APPWIDGET_SIZES))) {
return; return;
} }