Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8de41994 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Simplifying widget cell layout

Calculating the preview scale during onMeasure to ensure the
content is never clipped.

Bug: 268715418
Test: Verified on device
Change-Id: Ia0fd5ca3ccaae9644e043d75f810e91909a2aea0
parent 178802d3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
        android:layout_weight="1"
        android:importantForAccessibility="noHideDescendants"
        android:hapticFeedbackEnabled="false"
        android:clipChildren="false"
        android:layout_marginVertical="8dp">
        <!-- The image of the widget. This view does not support padding. Any placement adjustment
             should be done using margins. Width & height are set at runtime after scaling the
+9 −2
Original line number Diff line number Diff line
@@ -157,8 +157,15 @@ public class PendingItemDragHelper extends DragPreviewProvider {
                previewBounds.right -= padding;
            }
            if (mAppWidgetHostViewPreview != null) {
                previewWidth = mAppWidgetHostViewPreview.getMeasuredWidth();
                previewHeight = mAppWidgetHostViewPreview.getMeasuredHeight();
                float previewScale = mAppWidgetHostViewPreview.getScaleX();
                int widgetWidth = mAppWidgetHostViewPreview.getMeasuredWidth();
                int widgetHeight = mAppWidgetHostViewPreview.getMeasuredHeight();
                previewWidth = Math.round(widgetWidth * previewScale);
                previewHeight = Math.round(widgetHeight * previewScale);

                previewBounds.offset(
                        Math.round(widgetWidth * (previewScale - 1) / 2),
                        Math.round(widgetHeight * (previewScale - 1) / 2));
            } else {
                previewWidth = preview.getIntrinsicWidth();
                previewHeight = preview.getIntrinsicHeight();
+82 −251

File changed.

Preview size limit exceeded, changes collapsed.