Limit number of items grouped on a row to 3.
With shortcuts this allows for more space to display two word title
below without ellipsizing it. (screen/4pJvcFFKJhooqZU)
Also let widget description show upto 3 lines to more of it to show
when stacked (screen/7xv8ng4H7iRLU79)
Bug: N/A
Flag: N/A
Test: Screenshot
Change-Id: Ia4e30f943f602b811e607d9cb52152f78cdc20e5
diff --git a/res/layout/widget_cell_content.xml b/res/layout/widget_cell_content.xml
index 12453a5..8f786bf 100644
--- a/res/layout/widget_cell_content.xml
+++ b/res/layout/widget_cell_content.xml
@@ -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" />
diff --git a/src/com/android/launcher3/widget/util/WidgetsTableUtils.java b/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
index 5e0e203..edaf474 100644
--- a/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
+++ b/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
@@ -31,6 +31,7 @@
/** 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 @@
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