sleep: denser hypnogram time axis on narrow screens + hour-only, locale-aware marks - #1133
Merged
Conversation
…are marks
The stepped-hypnogram time axis stranded a phone at just onset/mid/wake — most
of the axis was empty. Two changes fill it:
- Density: ~60dp/label (was 90) with a floor of 4, so a ~360dp phone budgets ~6
labels and the round-hour step tightens (an 11h night now shows e.g. 03:00 and
06:00, not just 06:00); a tablet still fans out to the 8-label ceiling.
- Interior marks read as the HOUR ONLY and honour the device 12/24h setting
('06:00' / '6 AM') — shorter than the minute-precise onset/wake edges, so more
fit; edges gain AM/PM on 12h locales too. Guard widened 0.12->0.15 so the extra
interior marks can't crowd the edge labels.
Android-only (Filled/Ribbon hypnogram). Swift Hypnogram twin to follow for parity.
… fix) Self-review: axisHourLabel prints 'HH:00', but the step boundaries were aligned to UNIX-epoch multiples of stepH hours. On a half-hour-offset zone (UTC+5:30) an epoch-aligned 3h step lands at local :30, so the label would falsely read ':00'. Shift into local-epoch space by the zone offset before aligning, then shift back — local midnight is a whole multiple of stepSec for every stepH that divides 24, so every mark now lands on a true local :00. Test pins Asia/Kolkata.
ryanbr
added a commit
that referenced
this pull request
Aug 7, 2026
Re-review of #1133: the edge drop-guard was tuned for a ~40dp 24h edge label ('10:25'), but a 12h edge is wider ('10:25 AM' ~55dp). An interior mark near the old boundary (frac ~0.83) could touch the clamped onset/wake label on a 12h device — the axis Layout clamps edges into view but doesn't drop-on-collision. 0.18/0.82 gives the wider edge clearance and drops nothing on real nights (phone 03:00/06:00 at .32/.60; tablet 02/04/06/08 at .23-.78). Also drops a stale '~90dp' comment left from the density change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1130. On a phone the stepped-hypnogram axis was stranded at onset/mid/wake with most of the width empty. This fills it and cleans up the labels.
Changes
~60dp/label(was 90), floor 4. A ~360dp phone now budgets ~6 labels, so the round-hour step tightens: an 11h night (23:28→10:25) renders 23:28 · 03:00 · 06:00 · 10:25 instead of just 23:28 · 06:00 · 10:25. Tablets still fan out to the 8-label ceiling (unchanged).DateFormat.is24HourFormat:06:00on a 24h device,6 AMon a 12h one. Shorter than the minute-precise onset/wake edges, so more fit. Edges also gain AM/PM on 12h locales.0.12→0.15so the extra interior marks can't crowd the onset/wake labels (e.g. a 09:00 mark sitting right under 10:25 is dropped).Verification
compileFullDebugKotlin✓HypnogramAxisTicksTest✓ — added coverage for hour-only 24h marks and 12h AM/PM formatting (TZ-independent shape assertions).Android-only (Filled/Ribbon hypnogram). A Swift
Hypnogramaxis twin follows for feature parity.