Skip to content

Fix/UI day switch and polish - #56

Merged
sayed0am merged 11 commits into
sayed0am:mainfrom
Cryptobitsbee:fix/ui-day-switch-and-polish
Nov 10, 2026
Merged

sayed0am merged 11 commits into
sayed0am:mainfrom
Cryptobitsbee:fix/ui-day-switch-and-polish

Conversation

@Cryptobitsbee

@Cryptobitsbee Cryptobitsbee commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What this is

UI work only, in four commits you can review one at a time. No algorithm, database, protocol or permission changes. Built on main at v3.0.3 (a09baae1).

Versioning

No version bump and no release notes file, so this fits whichever release you choose. Nothing here touches stored data or the schema, so it could ship as a 3.0.3 patch or wait for the next release. There's a draft of release notes at the end if it helps.

The commits

1. Black window behind the app, and 48 dp tap targets

  • Both themes set windowBackground and colorBackground to black. The platform's dark Material default (#303030) could flash grey before the first frame.
  • Search's clear button, the exercise name's tick and the live workout's page dots get 48 dp to tap. Their drawn size and place are unchanged.

2. Detail pages move between days

  • The hero figure moves to the next day's (DayNumber). It counts one way only, and a change under 25 rolls. A scrub or a live reading still lands at once. Recovery's arc and Sleep's horizon arc sweep between days.
  • Recovery, Energy, Load and Active minutes keep the last day's page until the new day's result is worked out, at most 4 s, and not at all when the day failed. Before, they emptied to "No reading" and filled again. The strip follows the tap at once.
  • The week strip's pill, labels and dots fade between days.
  • Strip dots are read once for the whole strip, so a day keeps its dot whichever day is open. Heart points marks only the days the strap recorded points for (ActivityHistory.heartPointsDays, one extra dailyPai read for the days after the one shown).

3. The strap pill

The header's chip (a dot and a few words) is now the strap's state drawn in the pill (StrapPill.kt):

  • Connected: green up to the battery level, fading into the pill, with the percent in the middle. Amber when low.
  • Charging: the green flows along the pill, with a bolt before the number.
  • Not synced: orange, with the (i). This is a new StrapChip.Dot.Unsynced, split from Warn. The order and text in strapChip() are unchanged.
  • Not connected, connecting and not paired: the Strap page's strap drawing, dimmed, with its words. StrapDrawing gains lineScale for the small size. The Strap page and pairing draw it as before.

Spec 3.1 still describes the dot chip. If you keep this, I'm happy to update spec.md.

4. Goals and bests: medals

  • Every badge and best is a medal in the glow language. The face is lit from below with GlowPalette's tones, each group has its own shape (round firsts, hexagon milestones, a laurel for the weekly goal, a soft square for something new, a rosette for bests), and each badge has its own line picture. Locked medals are drawn quiet.
  • The page and All badges show only the medal and its name. A tap opens a sheet with how it's earned, when it was earned or how far along it is, and which workouts count. New strings core_badge_how_* and glow_goals_*, in English and Chinese. glow_goals_badges_count is replaced by glow_goals_badges.
  • The best card and the history badges screen use the medals too.
  • One logic change: rewardsView waited for a non-empty workout list, so a new user's page stayed on "Loading" for ever. It now also goes on when nothing is stored (dao.anyWorkoutOnce(), the same check RewardsKeeper.refresh uses). How badges and bests are earned is unchanged.

Review fixes

One commit each, described in the review reply: a failed day lets go of the held page, DayNumber takes the day its figure is for, one NumberFormat per figure, a badge sheet without its sentence instead of a crash, the intervals sentence for any workout, 48 dp taps for the page dots and the pill, not connected drawn whole, and Recovery's strap estimate held with its day.

Testing

  • :app:detektDebug, :protocol:detektMain and :app:lintDebug pass, with no new baseline entries.
  • :protocol:test passes. :app:testDebugUnitTest: 1,955 of 1,960 pass, and the same with -PtestLocale=de-DE. The other 5 fail the same way on an unchanged checkout on Windows: DataStore can't rename its file in ForgetDeviceTest and HabitAgeSeenTest, DetailRulesTest meets CRLF, and PhoneAlertsViewModelTest hits a timing race. They pass on Linux, so CI should be green.
  • New tests: DayNumberTest records every frame of a day's count and fails on the jump a first version made (2,500, 4,500, 2,500, then up), and on a live change animating after an equal day. MedalLabelTest checks the longest labels stay inside the inner ring at 64 and 156 dp.
  • Tried on a phone with a 3.0.3 demo build (-PdemoApp -PappVersion=3.0.3).

Notes

  • I wrote the Chinese strings for the new keys. A native speaker's check would be welcome.
  • Not changed here, but noticed: app/build.gradle.kts defaults local builds to 3.0.0, so a local debug build offers the current release as an update.
  • Written with AI assistance (Kiro).

Screenshots

pill state -4 Image pill state -2 pill state -1 Goals and bests -3 Goals and bests -2 Goals and bests -1

Draft release notes, if useful

## The look

- **Goals and bests:** every badge and best is now a medal with its own picture. Tap one to see how it's earned and when you got it, or how far along you are.
- **The strap in the header** shows its battery as a fill, flows while charging, and turns orange when a sync failed.
- Changing the day on a detail page moves its number to the new day's, and Recovery, Energy, Load and Active minutes no longer empty while the day is worked out.

## Fixes

- Goals and bests opens for someone with no workouts yet, instead of loading for ever.
- A day's dot under the strip no longer goes missing when you pick an earlier day.
- No grey flash before the app's first frame.
- Some small buttons are easier to tap.

## Upgrading

Installs over 3.0.3 and keeps all your data. Android 11 or newer.

@sayed0am

sayed0am commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Thanks for this! 👍 it's a careful PR. The four commits read well one at a time, and the medals and the strap pill look great. A few things to fix before merging:

1. A failed day keeps the last day's page up
rememberHeld in ScoreDetail.kt holds Recovery, Energy, Load and Active minutes until the new day's result arrives. When that day fails (RecoveryOutcome.Failed), the result never arrives. For 4 s the strip shows the new day selected while the figure and chart are still the old day's. Could the held page be dropped as soon as recoveryFailure is set for the new day, with the 4 s timeout kept only for a slow result?

2. DayNumber can animate a live reading
If the new day's figure has the same text as the old one, moving is false and shown.pending stays true. The next change on that day, such as a live Energy reading, then counts or rolls even though it should land at once. Clearing pending when the new day's value arrives, even if it's equal, should fix it.

3. BADGE_HOW.getValue in BadgeSheets.kt
Every current badge is covered, but a badge added to Rewards.BADGES without a core_badge_how_* string would crash the sheet. A fallback (no sentence, or a generic one) would make it safe.

4. The "first_reps" sentence
Rewards.badges awards it to any workout with a reps structure (Structure.Reps), not only runs. "Finish a run of intervals" reads as running only. Something like "Finish a workout of intervals, a distance or a time repeated with rest between" would match, in both languages.

5. Tap sizes (small)
The live workout's page dots are 48 dp wide now but still 28 dp tall. The new strap pill is 32 dp tall. If a full 48 dp doesn't fit the layout, that's fine. Just flagging it since the first commit is about tap targets.

6. PlainNumber.write (small)
It builds a new NumberFormat on every frame of a count. Making one per PlainNumber would avoid that.

7. Not connected as a broken strap
The broken drawing reads as damage, but not connected is usually temporary (out of range, Bluetooth off) and fixes itself. Since the pill is always in the header, could not connected use the whole dimmed strap with its words ("2 h ago", "Not connected"), like connecting and not paired? The words already tell the three apart. broken and the break constants in StrapDrawing could then go.

Cryptobitsbee and others added 11 commits November 10, 2026 13:59
The window behind Compose took the platform's dark Material theme, #303030,
which could show as a grey flash before the first frame. Both themes now set
the window and colour background to black.

- Search's clear button, the exercise name's tick and the live workout's page
  dots were 28 dp to tap. They are 48 dp now. The clear and the tick keep
  their drawn size and place; the page dots keep their height.
…ed out

Tapping another day cut every detail's figures over at once, and on Recovery,
Energy, Load and Active minutes the page first emptied to "No reading" while
the day's result was worked out, then filled again.

- The hero figure moves to the next day's (DayNumber). A plain number counts
  to it, one way only; a change under 25 rolls, the old figure sliding out as
  the new one slides in. A scrub or a live reading still lands at once.
  Recovery's arc and Sleep's horizon arc sweep between days.
- Recovery, Energy, Load and Active minutes keep the last day's page until
  the new day's result comes, at most 4 s, while the strip follows the tap.
- The week strip's pill, labels and dots fade between days.
- Strip dots come from one read for the whole strip, so a day keeps its dot
  whichever day is open: Recovery and Sleep no longer lose today's on an
  earlier day. Heart points marks only the strip's days the strap recorded
  points for (ActivityHistory.heartPointsDays).
- DayNumberTest records every frame of a count, and fails on the 2,500,
  4,500, 2,500 jump a first version made.
…strap

The header's strap chip was a dot and a few words. It is now the strap's state
drawn in the pill (StrapPill.kt):

- Connected: green as far as the battery, fading into the pill, the percent
  in the middle. Amber when low.
- Charging: the green flows along the pill, with a bolt before the number.
- Not synced: orange across the pill with the (i). It has its own
  StrapChip.Dot, Unsynced, apart from Warn.
- Not connected: the Strap page's strap drawing, cut across the pod and slid
  apart. Connecting or not paired: the strap whole and dim.
- StrapDrawing takes broken and lineScale for it; the Strap page and pairing
  draw it as before. The avatar and the pill sit on the Control surface
  (spec 2.2).
Each badge and best was a ring with a few letters and two lines of text under
it. Each is now a medal in the glow language (Medals.kt, MedalDrawing.kt): the
face lit from below with the glow cards' own tones (GlowPalette), a shape per
group (round firsts, hexagon milestones, a laurel for the weekly goal, a soft
square for something new, a rosette for bests) and a line picture per badge.
A medal still to earn is drawn quiet.

- The page and All badges show the medal and its name only. A tap opens its
  sheet: how it's earned, when, or how far along, and which workouts count.
  Each badge has its own sentence (core_badge_how_*), in English and Chinese.
- The page: This week, the bests as rosettes, the next badge with a bar, the
  badges, then All badges, Last week and Celebrations as rows. The best card
  and the badges history earned use the medals too.
- A new user's page no longer stays on "Loading" for ever. rewardsView waited
  for a non-empty list of workouts; it now goes on when nothing is stored
  (dao.anyWorkoutOnce, as RewardsKeeper.refresh tells the two apart). How
  badges and bests are earned is unchanged.
- MedalLabelTest checks the longest labels keep inside the inner ring at
  64 and 156 dp.
Recovery, Energy, Load and Active minutes held the last day's page for up to 4 s while the next day was worked
out. When that day failed, its result never came, so the strip showed the new day while the figure and chart
were still the old day's. The held page is now dropped as soon as the failure for the day shown is known; the
4 s limit stays for a result that's only slow.
… it lands

DayNumber was given the day picked, and waited for a figure to follow it. When the next day's figure came in
the same as the last day's, nothing moved and it kept waiting, so the next change on that day (a live Energy
reading) counted or rolled when it should have landed at once.

It now takes the day the figure is for. The pages that hold the last day's figures while the next is worked
out (Recovery, Energy, Load, Active minutes) pass the held day, so the figure and its day arrive together,
however late, and nothing is left waiting. The test that a change after an equal figure lands at once fails
on the old code.
PlainNumber.write built a new NumberFormat for every frame a figure counted through. Each PlainNumber now makes its own once.
…ls of any kind

A badge added to Rewards.BADGES without a core_badge_how_* sentence made BADGE_HOW.getValue throw when its
sheet opened. The sheet now shows without the sentence instead.

First reps is earned by any workout of repeated intervals (Structure.Reps), not only runs, so its sentence
says a workout, in English and Chinese.
The live workout's page dots were 48 dp wide but 28 dp tall. Each is now a 48 dp square to tap, still laid out
28 dp tall, so the live screens keep their height: the 10 dp above and below reach into the bottom bar's 14 dp
gaps, never over the controls.

The strap pill takes 48 dp of the header's 60 dp to tap (minimumInteractiveComponentSize), drawn 32 dp tall
as before. The Strap page still grows out of the pill as drawn.
The strap drawn broken read as damage, but not connected is mostly out of range or Bluetooth off, and passes
by itself; the pill is always in the header. Not connected now shows the whole, dimmed strap with its words,
as connecting and not paired do; the words ("2 h ago", "Not connected") tell the three apart.

StrapDrawing loses broken and its break constants, so it's the Strap page's drawing again, with only
lineScale added for the pill's small size.
…es too

While Recovery is still learning, the number on its detail is the strap's own score, and that came from the
day picked rather than the held page. So while the next day was worked out, the held page had no number: the
gauge went and came back with the next day's number instead of counting to it. The strap's score is now held
with the rest of the day's page.
@Cryptobitsbee
Cryptobitsbee force-pushed the fix/ui-day-switch-and-polish branch from 5fc30fd to 74ea5a4 Compare November 10, 2026 11:30
@Cryptobitsbee

Cryptobitsbee commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review! All seven are fixed, each in its own commit. I also rebased the branch onto main at v3.0.3 (a09baae1), so everything is built and tested on 3.0.3 now, not 3.0.1. The four original commits are unchanged by the rebase.

1. A failed day keeps the last day's page up (0d5b9c5b)
rememberHeld now takes failed (recoveryFailure?.date == state.date, passed in from DetailHost) and lets go at once when the day shown failed. The 4 s limit stays for a result that's only slow. Energy's held page does the same.

2. DayNumber can animate a live reading (807f6c89)
Rather than waiting for the figure to follow the picked day (pending), DayNumber now takes the day the figure is for. The pages that hold the last day's figures (Recovery, Energy, Load, Active minutes) pass the held day, through a new headlineDay on DetailTemplate, so the figure and its day arrive together and nothing is left waiting. pending is gone. DayNumberTest has a case for it (the next day comes in equal, then a live change lands at once), and it fails on the old code.

3. BADGE_HOW.getValue in BadgeSheets.kt (8ab80e7d)
howToEarn returns null for a badge without a sentence, and the sheet shows without one instead of crashing.

4. The "first_reps" sentence (8ab80e7d)
Now "Finish a workout of intervals, a distance or a time repeated with rest between.", and "完成一次间歇训练,按距离或时间重复,中间休息。" in Chinese. I left the badge's title as it is.

5. Tap sizes (99227e63)

  • The page dots are now 48 dp squares to tap, still laid out 28 dp tall. The extra 10 dp each side reaches into the bottom bar's 14 dp gaps, so the live screens keep their height and nothing overlaps the controls.
  • The strap pill uses minimumInteractiveComponentSize(): 48 dp of the header's 60 to tap, drawn 32 dp tall as before. The Strap page still grows out of the drawn pill.
  • I checked both with a quick Robolectric tap test (not added to the PR): a tap 8 dp outside the dots' row lands, 12 dp doesn't, and the pill takes taps across its 48 dp.

6. PlainNumber.write (5b861c2a)
One NumberFormat per PlainNumber, made once.

7. Not connected as a broken strap (8076e0fc)
Agreed. Not connected now shows the whole, dimmed strap with its words, as connecting and not paired do. broken and the break constants are gone from StrapDrawing, so it's your drawing again with only lineScale added for the pill's size.

One more, found while testing (74ea5a40)
While Recovery is still learning, its detail shows the strap's estimate. That came from the picked day rather than the held page, so the gauge emptied and came back instead of counting to the next day. The strap's score is now held with the rest of the page.

Testing, on 3.0.3

  • :app:lintDebug, :app:detektDebug and :protocol:detektMain pass, with no new baseline entries.
  • :protocol:test passes. :app:testDebugUnitTest passes 1,955 of 1,960, and the same with -PtestLocale=de-DE. The other 5 are the same Windows-only failures as before (DataStore's rename in ForgetDeviceTest and HabitAgeSeenTest, CRLF in DetailRulesTest, the timing race in PhoneAlertsViewModelTest).
  • Tried on a phone with a 3.0.3 demo build (-PdemoApp -PappVersion=3.0.3).

The CI run is waiting for your approval, since the PR comes from a fork.

@sayed0am
sayed0am merged commit 8d38b57 into sayed0am:main Nov 10, 2026
5 checks passed
@sayed0am

Copy link
Copy Markdown
Owner

Thanks alot for those fixes im spending most of time ironing backend bug right now , didn't even notice rewards wasn't working

@Cryptobitsbee
Cryptobitsbee deleted the fix/ui-day-switch-and-polish branch November 13, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants