Start a new widget at its natural width in whole columns

The shell's widgetLimits now reports the provider's natural width ("w"), and
when a widget is added the page turns it into grid columns (WIDGET_COLS), so a
small widget takes the columns it needs instead of the whole row. Resizing
still snaps to whole columns and rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V
This commit is contained in:
Claude committed 2026-10-22 06:02:10 +00:00
1 parent 43cb884a5d
commit 205c7dbed2
4 files changed
+25 -5

No files matched your search

@@ -482,8 +482,9 @@ public class MainActivity extends Activity {
}
/**
* How far a placed widget may be resized, in CSS px: {"minW", "minH", "maxW", "maxH"
* (0 = no limit), "h", "v" (whether it resizes horizontally / vertically)}.
* A placed widget's natural width and how far it may be resized, in CSS px: {"w",
* "minW", "minH", "maxW", "maxH" (0 = no limit), "h", "v" (whether it resizes
* horizontally / vertically)}.
*/
private String widgetLimits(int id) {
AppWidgetProviderInfo w = widgets.getAppWidgetInfo(id);
@@ -499,7 +500,8 @@ public class MainActivity extends Activity {
maxW = w.maxResizeWidth;
maxH = w.maxResizeHeight;
}
o.put("minW", Math.round(minW / d)).put("minH", Math.round(minH / d))
o.put("w", Math.round(w.minWidth / d))
.put("minW", Math.round(minW / d)).put("minH", Math.round(minH / d))
.put("maxW", Math.round(maxW / d)).put("maxH", Math.round(maxH / d))
.put("h", (w.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0)
.put("v", (w.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0);