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

Commit 6ce6922c authored by Steven Ng's avatar Steven Ng Committed by Android (Google) Code Review
Browse files

Merge "Deduct padding from widget size only if padding has been inset" into sc-dev

parents 3287dd9f 71cefb59
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -99,11 +99,13 @@ public final class WidgetSizes {
     */
     */
    public static Bundle getWidgetSizeOptions(Context context, ComponentName provider, int spanX,
    public static Bundle getWidgetSizeOptions(Context context, ComponentName provider, int spanX,
            int spanY) {
            int spanY) {
        boolean shouldInsetWidgets =
                LauncherAppState.getIDP(context).getDeviceProfile(context).shouldInsetWidgets();
        ArrayList<SizeF> sizes = getWidgetSizes(context, spanX, spanY);
        ArrayList<SizeF> sizes = getWidgetSizes(context, spanX, spanY);
        Rect padding = getDefaultPaddingForWidget(context, provider, null);
        Rect padding = getDefaultPaddingForWidget(context, provider, null);
        float density = context.getResources().getDisplayMetrics().density;
        float density = context.getResources().getDisplayMetrics().density;
        float xPaddingDips = (padding.left + padding.right) / density;
        float xPaddingDips = shouldInsetWidgets ? (padding.left + padding.right) / density : 0;
        float yPaddingDips = (padding.top + padding.bottom) / density;
        float yPaddingDips = shouldInsetWidgets ? (padding.top + padding.bottom) / density : 0;


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