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

Commit 2dfe2e35 authored by Shamali Patwa's avatar Shamali Patwa Committed by Android (Google) Code Review
Browse files

Merge "Limit number of items grouped on a row to 3." into main

parents a06b40c1 31329478
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@
                    android:gravity="center_horizontal"
                    android:textSize="@dimen/widget_cell_font_size"
                    android:textColor="?android:attr/textColorSecondary"
                    android:maxLines="2"
                    android:maxLines="3"
                    android:ellipsize="end"
                    android:fadingEdge="horizontal"
                    android:alpha="0.7" />
+3 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import java.util.stream.Collectors;

/** An utility class which groups {@link WidgetItem}s into a table. */
public final class WidgetsTableUtils {
    private static final int MAX_ITEMS_IN_ROW = 3;

    /**
     * Groups widgets in the following order:
@@ -125,7 +126,8 @@ public final class WidgetsTableUtils {
                widgetItemsAtRow.add(widgetItem);
                containerSizeForRow = containerSize;
                currentRowWidth = containerWidth;
            } else if ((currentRowWidth + containerWidth) <= rowPx
            } else if (widgetItemsAtRow.size() < MAX_ITEMS_IN_ROW
                    && (currentRowWidth + containerWidth) <= rowPx
                    && widgetItem.hasSameType(widgetItemsAtRow.get(numOfWidgetItems - 1))
                    && containerSize.equals(containerSizeForRow)) {
                // Group items in the same row if