Skip to content

sleep: denser hypnogram time axis on narrow screens + hour-only, locale-aware marks - #1133

Merged
ryanbr merged 2 commits into
mainfrom
feat/hypnogram-axis-density
Aug 7, 2026
Merged

sleep: denser hypnogram time axis on narrow screens + hour-only, locale-aware marks#1133
ryanbr merged 2 commits into
mainfrom
feat/hypnogram-axis-density

Conversation

@ryanbr

@ryanbr ryanbr commented Aug 7, 2026

Copy link
Copy Markdown
Owner

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

  • Density~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).
  • Hour-only, locale-aware marks — interior round-hour labels drop the minutes and honour DateFormat.is24HourFormat: 06:00 on a 24h device, 6 AM on a 12h one. Shorter than the minute-precise onset/wake edges, so more fit. Edges also gain AM/PM on 12h locales.
  • Edge guard widened 0.12→0.15 so 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).
  • i18n gate ✓ (format patterns aren't UI literals; no baseline change).
  • Design tokens only; render-only (totals/percentages untouched).

Android-only (Filled/Ribbon hypnogram). A Swift Hypnogram axis twin follows for feature parity.

ryanbr added 2 commits August 8, 2026 00:29
…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
ryanbr merged commit 765dd74 into main Aug 7, 2026
3 checks passed
@ryanbr
ryanbr deleted the feat/hypnogram-axis-density branch August 7, 2026 12:33
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.
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.

1 participant