Sleep: stop the stage strip clipping into a row of circles (#36)#38
Merged
Conversation
The Android sleep-hero stage strip (HypnogramWithAxis) floored each segment to a min width (one strip-height, 34dp) and advanced x by that FLOORED width. On a fragmented on-device night (e.g. a WHOOP 5.0 metadata-only sync with many short approximate segments) the floored widths sum past the canvas, so the tail runs off-screen and clips — only the first ~w/h segments stay visible. Drawn with a h-wide round-capped line, each sub-h segment renders as a full circle, so the night reads as a disconnected row of circles on a single line (issue #36). Fix, keeping the single strip: floor every segment, then if the floored total overflows the canvas, scale them ALL to fit so the strip is a continuous bar for the whole night. Draw rounded RECTS advancing by the same width they're drawn, so x can never exceed the canvas and narrow segments read as thin blocks, not circles. Proportions of normal-width segments are unchanged. Fixes #36.
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.
What #36 reported
On Android the sleep-hero stage graphic renders as a single row of disconnected circles (WHOOP 5.0, on-device staging) instead of a continuous stage strip.
Root cause
HypnogramWithAxisfloored each segment to a min width (minSegW = h, 34dp) and advancedxby that floored width. Two things then break on a fragmented night (a WHOOP 5.0 metadata-only sync produces many short approximate segments):xruns off-screen and the tail clips. Only the first ~w/hsegments (≈ the ~13 circles in the screenshot) stay visible; the rest of the night is drawn off-canvas.h-wide round-capped line, so any sub-hsegment renders as a fullh-diameter circle rather than a block.Together: a disconnected row of circles on one line.
The fix (minimal — keeps the single strip)
xcan never exceed the canvas and a narrow segment reads as a thin block, not a circle.~20 lines in one function, no analytics change, no new composables.
Notes
compileFullReleaseKotlin).Fixes #36.