Widgets: fixes from the pre-release audit

Clock:
- Weather requests send only "FlexeraLauncher" as their user agent, no
  longer Android's, which names the phone model and build.
- Celsius or Fahrenheit follows Android's own temperature setting where
  there is one (Android 14 and newer), else the locale.
- Failed weather requests back off (5, 10, 20, 40, then 45 minutes)
  instead of retrying every time the home screen returns.
- The options sheet's segments switch to a list at large font sizes and
  read left to right for alignment in right-to-left languages; the spoken
  time says AM or PM in 12-hour mode.

Pictures, and both widgets' data:
- When Android restores widgets, the pictures and the clock's options
  move to the new ids instead of being deleted.
- The setup screen survives being recreated while photos are copied;
  photos staged for a widget that never got set up are cleared after the
  home screens load.
- Slides are decoded at about the frame's size, let go of in the
  background, and the slideshow pauses while the widget cannot be seen.
- No "Tap to choose pictures" over the sample while a photo loads; the
  empty widget's hint stays readable at large font sizes, off the sun.
- Canvas-drawn text follows Android's Bold text setting.

The drop animation of another app's widget lands at the size the widget
will have (the icon-aligned inset was added instead of taken off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TMCandClaude Opus 5.5 committed 2026-11-14 18:50:50 +01:00
1 parent ec7d3bc004
commit 42f728fd82
14 files changed
+893 -136

No files matched your search

+29 -10
View File
@@ -3275,6 +3275,20 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
private Drawable createWidgetDrawable(ItemInfo widgetInfo, View layout) {
int[] unScaledSize = estimateItemSize(widgetInfo);
if (widgetInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET
&& getChildCount() > 0) {
// Flexera Launcher: the widget is drawn for the drop animation at the size it is
// laid out at, its cells less the room it keeps in them, which is where the
// animation lands it (getFinalPositionForDropAnimation). Drawn at its cells whole,
// as Launcher3 draws it, the picture is squeezed into that box and then gives way
// to the widget's own layout, so its text and pictures jump as the animation ends.
CellLayout cl = (CellLayout) getChildAt(0);
Rect inset = app.flexera.widget.FlexeraWidgets.cellInset(
widgetInfo.getTargetComponent(), mLauncher.getDeviceProfile(),
cl.getCellWidth(), cl.getCellHeight());
unScaledSize[0] = Math.max(1, unScaledSize[0] - inset.left - inset.right);
unScaledSize[1] = Math.max(1, unScaledSize[1] - inset.top - inset.bottom);
}
int visibility = layout.getVisibility();
layout.setVisibility(VISIBLE);
@@ -3299,16 +3313,21 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
Rect r = estimateItemPosition(layout, targetCell[0], targetCell[1], spanX, spanY);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET) {
DeviceProfile profile = mLauncher.getDeviceProfile();
if (finalView instanceof NavigableAppWidgetHostView) {
// Flexera Launcher: the room this widget keeps in its cells.
Point cell = profile.getCellSize();
Rect widgetPadding = app.flexera.widget.FlexeraWidgets.cellInset(
finalView, profile, cell.x, cell.y);
r.left -= widgetPadding.left;
r.right += widgetPadding.right;
r.top -= widgetPadding.top;
r.bottom += widgetPadding.bottom;
}
// Flexera Launcher: the drop lands on the box the widget is laid out in, its cells
// less the room it keeps in them, worked out from the cells of the page it lands on
// as ShortcutAndWidgetContainer does. Launcher3 added that room on instead of taking
// it off, and left it out when the widget had no view yet (one that has to be set up
// first); with the room that lines other apps' widgets up with the icons, a dropped
// widget grew past its cells and then jumped to its real size. Whose widget it is
// comes from the item, because one dropped from the list of widgets is not tagged
// with it yet.
Rect widgetPadding = app.flexera.widget.FlexeraWidgets.cellInset(
info.getTargetComponent(), profile,
layout.getCellWidth(), layout.getCellHeight());
r.left += widgetPadding.left;
r.right -= widgetPadding.right;
r.top += widgetPadding.top;
r.bottom -= widgetPadding.bottom;
PointF appWidgetScale = profile.getAppWidgetScale(null);
Utilities.shrinkRect(r, appWidgetScale.x, appWidgetScale.y);
}