Skip to content

✨ Draw the hit timer chart with Grafima - #1125

Open
LeoColman wants to merge 1 commit into
mainfrom
feat/hittimer-grafima
Open

✨ Draw the hit timer chart with Grafima#1125
LeoColman wants to merge 1 commit into
mainfrom
feat/hittimer-grafima

Conversation

@LeoColman

Copy link
Copy Markdown
Owner

Moves the hit timer's "Why 10 seconds?" chart from GraphView to Grafima. This
was the last com.jjoe64 usage, so the dependency, its entry in the
graph-view bundle and its licensee exception all leave with it. MPAndroidChart
stays behind for the three Stats charts.

Before / after

GraphView Grafima

Both at rest, so the hold markers sit at 0 seconds on each curve.

What changes visually:

  • Hold markers are smaller. Dot radius is a property of the chart rather
    than of a series, so the markers cannot be size-15 against default curve dots
    any more. They are separated by colour instead, the same treatment the
    withdrawal charts already use.
  • Y ticks land on 0/12/24/36/48/60 rather than 0/20/40/60, and x ticks on
    the three measured points rather than every 5 seconds. Grafima picks its own
    tick counts.
  • Vertical gridlines are switched back on to match GraphView. Reading where ten
    seconds falls is the entire point of the chart.

Two things worth knowing for the next migration

Grafima animates, GraphView did not. The old chart lived in an AndroidView,
outside Compose's clock. Once the chart moved inside it, an animation that never
settles kept Compose busy, which stalled the timer's own recomposition:
ComposeHitTimerTest's "Start" and "Reset" both failed on a 20s timeout waiting
for the countdown to advance. There is no flag to disable animation, so the
specs are snap(). That is also the behaviour we want here, since the marker
tracks a running timer and a morph spec would always draw where the hold was.

The x axis labels come from each LineDataPoint's own label, not from
axisConfig's formatter. They were rendering as 10.0 because the label was
seconds.toString(). Setting xLabelFormatter looks like the fix and does
nothing at all.

Other

holdPointOn and the two study series drop GraphView's DataPoint for a
SubjectiveHighPoint with value equality, which lets WhyTenSecondsTest stop
comparing rendered strings.

Release APK 11,076,168 -> 11,049,255 bytes (-26,913, -0.24%), measured by
building both sides. Nice counterweight to the +32 KB Grafima cost in #1124.

Verification

  • ./gradlew test detekt licensee green
  • 25 instrumented tests green on the API 34 managed device
  • assembleFdroidRelease green through R8; no com/jjoe64 entries left in the APK
  • Driven by hand on an emulator: chart renders, and the markers track along both
    curves while a hold runs

The two screenshots live on the assets/hittimer-grafima branch so they stay
out of this diff and out of main. Delete that branch whenever this merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_0167SJeKBmjmzhj9gNWcZYfs

Moves the last chart off GraphView, so com.jjoe64 leaves the project
altogether: the dependency, its bundle and its licensee exception are all
gone. MPAndroidChart stays for the three Stats charts.

Two things the swap needed that were not obvious:

Grafima animates, and GraphView did not, because it sat in an AndroidView
outside Compose's clock. An animation that never settles keeps Compose busy,
which stalled the timer's own recomposition and hung two ComposeHitTimerTest
cases on a 20s timeout. There is no flag to turn animation off, so the specs
are snapped. That is also the behaviour we want: the marker tracks a running
timer, and a morph would always draw where the hold was, not where it is.

The x axis labels come from each LineDataPoint's own label rather than from
axisConfig's formatter, so they are rounded to whole seconds. Setting
xLabelFormatter looks like it should work and does nothing.

The hold markers lose their size-15 emphasis: dot radius belongs to the chart,
not to a series, so colour is what separates them from the curves now. Same
treatment as the withdrawal charts. Vertical gridlines are switched back on to
match what GraphView drew, since reading where ten seconds falls is the point.

holdPointOn and the two study series drop GraphView's DataPoint for a
SubjectiveHighPoint, which has value equality, so WhyTenSecondsTest can stop
comparing rendered strings.

Release APK 11,076,168 -> 11,049,255 bytes (-26,913, -0.24%).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0167SJeKBmjmzhj9gNWcZYfs
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