Skip to content

Keep the widget's smallest sizes readable, and redraw it when a setting it draws changes - #189

Merged
lumenpearson merged 3 commits into
mainfrom
agents/widget-small-sizes
Sep 27, 2026
Merged

lumenpearson merged 3 commits into
mainfrom
agents/widget-small-sizes

Conversation

@lumenpearson

Copy link
Copy Markdown
Owner

Description

Two widget defects, both seen on the emulator and both fixed and seen again there.

# What was wrong What it does now
#174 A 2×2 on a phone read «4 урока · Алгебра в 08:…» and listed two of three homework subjects over an empty lower half. A 2×1 at the largest font read «Д… 3 предмета» The day plan spends its character budget on the subject and keeps the count and the time: «4 урока · Алгеб… в 08:30». On the narrow rungs it may take a second line. SMALL_TALL lists three subjects after school. At any font above the default, the 2×1 draws the count as the bare figure: «ДЗ на завтра 3», or «ДЗ на завтра нет»
#188 Switching the app's language, «Прогресс в виджете» or the teacher switch left the widget drawing the old setting until something unrelated redrew it; a 304 sync did not, and on a day off the next tick is hours away SettingsRepositoryImpl.update sends DATA_SYNCED when AppSettings.drawnByWidget moves, and the widget reads its settings through that projection only

#174's diagnosis was corrected before the fix (in the issue's thread). The body said the 2×2 landed on LARGE. At about 195×226 dp, LARGE (250×250) does not fit inside the box, so it lands on SMALL_TALL. The cut came from SMALL_TALL's 24-character budget applied from the end of a 25-character line. WidgetSizeClassTest now pins where a phone's 2×2 lands.

#188 was found while checking #174 and filed before its fix. To test it without a DataStore, which this module's JVM tests cannot open, SettingsRepositoryImpl now reads a small SettingsStore interface. LessonsPreferences implements it the way it already implements DiarySessionStore and ShellModeSource.

HANDOVER.md carries the close-out.

Closes #174
Closes #188

What is affected

  • server/app/api — the client-facing API
  • server/app/bot — the bot
  • server/app/services — the rules the bot and the API share
  • server/app/providers/petersburg — the electronic diary
  • server/migrations — the database schema
  • android/core/model — the models and the state engine
  • android/core/data — Room, network, sync, notifications
  • android/core/designsystem — theme and components
  • android/widget — the widget
  • android/app — the screens
  • docs/, README.md
  • .github/ — build and automation

Boundaries

  • app/schedule.py still imports neither FastAPI nor aiogram — the server is not touched
  • The rule did not appear in two places — one projection, drawnByWidget, both draws the widget's settings and decides its redraw
  • A model change comes with an Alembic revision — no server model change; EXPECTED_REVISION is still 0017
  • Nothing is scheduled "in process" on the server
  • "Now" is taken in the class's time zone — nothing here reads a clock
  • :core:data does not depend on :widget — the redraw goes through the existing broadcast
  • Every new Russian string has its English twin in values-en/ — widget_homework_none_short
  • There is no token, class code, password or keystore path in the diff

Verification

cd android && ./gradlew test assembleDebug assembleRelease → BUILD SUCCESSFUL
  1459 tests, 0 failures (:core:model 125, :core:data 543, :core:designsystem 112, :widget 123, :app 556)

The server was not touched, so ruff, mypy and pytest were not run.

Each new test was run against the old behaviour first:

What is NOT covered

  • The rule that the one-line size drops the noun above font scale 1.0 is a step, not a measurement. It was seen at 2.0 on one emulator only.
  • The one-line size during lessons at a large font («ПЕРЕМЕНА 7 мин», the label weighted beside the countdown) was not looked at.
  • A change of the system font scale is a configuration change, not an app setting. Whether anything redraws the widget after one was not checked: here each render was forced with a reinstall.
  • The plan line's budget is still a count of characters. At 195 dp the whole «4 урока · Алгебра в 08:30» would fit, and it is shortened anyway, because the rung serves 110 dp too.
  • Walk the widget's twelve sizes on a real launcher, at two font scales #113, the rest of the ladder on a real launcher, stays open.

Documentation

  • docs/ updated — docs/widget.md says what gives way on the smallest sizes, and that a settings change redraws the widget
  • CLAUDE.md updated — no command, module or boundary changed
  • README.md updated — the gate table's count, with the close-out
  • No update needed

🤖 Generated with Claude Code

program-perfect and others added 2 commits September 27, 2026 12:41
…t sizes

A 2×2 on a phone read «4 урока · Алгебра в 08:…» with two of three
homework subjects over an empty lower half, and a 2×1 at the largest font
read «Д… 3 предмета». The issue put the 2×2 on LARGE; it is SMALL_TALL.
At about 195×226 dp, LARGE does not fit inside the box, and the cut was
SMALL_TALL's 24-character budget applied to a 25-character line, from
its end.

The plan line now spends its budget on the subject. The count and the
time are what it is for: «4 урока · Алгеб… в 08:30». On the narrow rungs
it may take a second line rather than be clipped at 110 dp. SMALL_TALL
lists three homework subjects after school; in 190 dp that is about 130
dp of content, 175 at the worst, and NARROW above it has three already.

On the 2×1 the label is weighted and the count is not, so an enlarged
font took the width from the label. From the first step above the
default the count is drawn as the bare figure, «ДЗ на завтра 3», or
«ДЗ на завтра нет» with a new string and its English twin. The rule is
a step rather than a measurement, because Glance can measure neither
text nor the box.

DayPlanTest, TinyCountTest and a pinned 2×2 in WidgetSizeClassTest fail
on the old code, five of them. On the emulator the 2×2 read «4 урока ·
Алгеб… в 08:30» over three subjects, and the 2×1 at font scale 2.0
read «ДЗ на завтра 3». Not checked: the one-line size during lessons
at a large font («ПЕРЕМЕНА 7 мин»), and any phone but this emulator.

Closes #174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Switched to Russian on the emulator, the app redrew at once and the 2×2
widget went on saying «DAY OFF» and «HW for tomorrow». A pull-to-refresh
answered 304 and did not redraw it either, and only a reinstall did. The
widget draws three settings: the language, «Прогресс в виджете» and the
teacher switch. It is redrawn by DATA_SYNCED, which a sync sends only
when the data changed, and by its own tick, which on a day off is hours
away. A settings change was neither.

SettingsRepositoryImpl.update now sends DATA_SYNCED when
AppSettings.drawnByWidget moves, beside the alert re-arm it already did
the same way. The widget reads its settings through that projection and
nothing wider, so a setting it starts to draw cannot be drawn without
also being the thing that asks for a redraw.

The repository reads a SettingsStore now, which LessonsPreferences
implements the way it implements DiarySessionStore and ShellModeSource,
so WidgetSettingsRedrawTest can hand it a map: this module's JVM tests
cannot open a DataStore. Its first case fails without the call. On the
emulator, Russian before the switch to English and English three
seconds after it, with no reinstall in between.

Not covered: a change of the system font scale, which decides the rung
and the one-line count, is a configuration change rather than a setting
and was not watched to see whether anything redraws after it.

Closes #188

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lessons Ready Ready Preview Sep 27, 2026 9:47am UTC

…they left

HANDOVER.md opens on #189 and gains its batch: #174's diagnosis
corrected (the phone's 2×2 is SMALL_TALL, not LARGE) before the fix,
the fix, #188 found while checking it and fixed, what the emulator
showed in both languages and at font scale 2.0, how the widget can and
cannot be redrawn from a shell, and the gates on 675cafe. #187's section
becomes «What the session before it added» and records its merge; the
chain below shifts by one, and two references to #186's section now
name it by its subject, since «What the batch before added» is shared.
Section 5 says what #189 did not see: the one-line size during lessons
at a large font, a system font-scale change, any other launcher. Section
7 has this batch's cost in disk.

The Android test count is 1459 in its three places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lumenpearson
lumenpearson marked this pull request as ready for review September 27, 2026 09:54
@lumenpearson
lumenpearson merged commit 938e59f into main Sep 27, 2026
5 checks passed
@lumenpearson
lumenpearson deleted the agents/widget-small-sizes branch September 27, 2026 10:08
lumenpearson pushed a commit that referenced this pull request Oct 2, 2026
…nto the history

The opening names #214 as merged at eb0ab94 and this pull request as the one
thing open; a section on top describes the three bumps and #212's fix; the
audit batch becomes the session before it, and the widget batch (#189) goes
verbatim to the top of docs/history.md. The server test count moves to 2064 in
README.md, docs/architecture.md, CLAUDE.md and this file's cheat-sheet, and the
milestone tables name #218.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RjGnZtszhBT53XZM7vabV

This branch was successfully deployed

1 active deployment
Preview — cad84a8d Deployed Sep 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

2 participants