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

Commit 71cefb59 authored by Steven Ng's avatar Steven Ng
Browse files

Deduct padding from widget size only if padding has been inset

Test: Set the grid to 4x5 (without padding) and verify the min / max
      size sent to Conversation widget is expected.
Bug: 190498032
Change-Id: I8ef6e5d897ebd0e2ea9af4497b00059c8dfad70a
parent 29dba381
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -99,11 +99,13 @@ public final class WidgetSizes {
     */
    public static Bundle getWidgetSizeOptions(Context context, ComponentName provider, int spanX,
            int spanY) {
        boolean shouldInsetWidgets =
                LauncherAppState.getIDP(context).getDeviceProfile(context).shouldInsetWidgets();
        ArrayList<SizeF> sizes = getWidgetSizes(context, spanX, spanY);
        Rect padding = getDefaultPaddingForWidget(context, provider, null);
        float density = context.getResources().getDisplayMetrics().density;
        float xPaddingDips = (padding.left + padding.right) / density;
        float yPaddingDips = (padding.top + padding.bottom) / density;
        float xPaddingDips = shouldInsetWidgets ? (padding.left + padding.right) / density : 0;
        float yPaddingDips = shouldInsetWidgets ? (padding.top + padding.bottom) / density : 0;

        ArrayList<SizeF> paddedSizes = sizes.stream()
                .map(size -> new SizeF(