Preview layout scaling for RemoteViews preview
RemoteViews may contain multiple layouts. The best fit layout is picked after layout. Let's ensure the best fit layout is picked before scaling a preview Test: Manual Fix: 196044656 Change-Id: I41b9f70040befaf96a9af95f9399a816eb0b71cb
This commit is contained in:
1 parent
0a39f6daec
commit
f64b08dcb9
1 file changed
+14
@@ -483,6 +483,20 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
mAppWidgetHostViewPreview.measure(
|
||||
makeMeasureSpec(MAX_MEASURE_SPEC_DIMENSION, MeasureSpec.UNSPECIFIED),
|
||||
makeMeasureSpec(MAX_MEASURE_SPEC_DIMENSION, MeasureSpec.UNSPECIFIED));
|
||||
if (mRemoteViewsPreview != null) {
|
||||
// If RemoteViews contains multiple sizes, the best fit sized RemoteViews will be
|
||||
// selected in onLayout. To work out the right measurement, let's layout and then
|
||||
// measure again.
|
||||
mAppWidgetHostViewPreview.layout(
|
||||
/* left= */ 0,
|
||||
/* top= */ 0,
|
||||
/* right= */ mTargetPreviewWidth,
|
||||
/* bottom= */ mTargetPreviewHeight);
|
||||
mAppWidgetHostViewPreview.measure(
|
||||
makeMeasureSpec(mTargetPreviewWidth, MeasureSpec.UNSPECIFIED),
|
||||
makeMeasureSpec(mTargetPreviewHeight, MeasureSpec.UNSPECIFIED));
|
||||
|
||||
}
|
||||
View widgetContent = mAppWidgetHostViewPreview.getChildAt(0);
|
||||
int appWidgetContentWidth = widgetContent.getMeasuredWidth();
|
||||
int appWidgetContentHeight = widgetContent.getMeasuredHeight();
|
||||
|
||||
Reference in new issue
Block a user