Skip to content

Add a Compose API, screenshot tests and CI - #8

Merged
zjywill merged 1 commit into
masterfrom
compose-api-and-ci
Aug 11, 2026
Merged

Add a Compose API, screenshot tests and CI#8
zjywill merged 1 commit into
masterfrom
compose-api-and-ci

Conversation

@zjywill

@zjywill zjywill commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Compose is the reason a new project would or would not pick this library up, and there was no CI to notice that master had been unbuildable since 1.6.

Shared geometry

HiveGeometry now owns the comb layout and the fade wave as plain functions with no Android dependencies, and HiveProgressView delegates to it. Writing the trigonometry a second time for Compose would have let the two renderers drift apart; this way they cannot.

overwatch-compose

A HiveProgress() composable drawing the same comb through Canvas and rememberInfiniteTransition. Two things worth calling out:

  • Corner rounding is built into the path with quadratics, because Compose applies a PathEffect only to strokes — CornerPathEffect has no fill equivalent.
  • There is a stateless overload taking the wave position. That makes the output a pure function of its arguments, which is what the screenshot tests pin, and it lets callers drive the wave from their own animation.

Unlike the View, it reports itself as an indeterminate progress indicator to accessibility services.

AGP 9 ships built-in Kotlin support, so org.jetbrains.kotlin.android must not be applied — it now fails the build outright. The Compose compiler plugin is pinned to 2.2.10 to match the kotlin-gradle-plugin AGP bundles.

Tests

Nine JVM tests over HiveGeometry, pinning the invariant the spacing parameter exists to provide — all six neighbours of the centre cell stay equidistant — plus that the comb never escapes its box, the radius never goes negative, and the wave order is a permutation.

Six Roborazzi screenshots cover zero spacing, wide spacing, rounded corners, mid-wave and shrink.

CI

Assembles debug and release, lints, runs both test suites, and rehearses the JitPack publish with -Pgroup/-Pversion so a broken release is caught before the tag is cut rather than after. Diffs and lint reports upload as artifacts on failure.

Release builds already earned their keep: they caught a debugImplementation tooling dependency leaking into the demo's @Preview code, which assembleDebug happily accepted.

Demo

Now Compose, edge-to-edge, and renders both implementations from one spacing slider so any divergence between them is visible side by side. Verified on a OnePlus 6 (Android 11) — the two combs agree on layout, colour and spacing.

Note before tagging 2.1.0

The README still advertises the verified 2.0.0 coordinate. This PR adds a second publishable module, and JitPack names artifacts differently once a repository publishes more than one — the exact coordinates should be read off the 2.1.0 build log before the README claims them.

🤖 Generated with Claude Code

Compose is the reason a new project would or would not pick this library up,
and there was no CI to notice that master had been unbuildable since 1.6.

Shared geometry: HiveGeometry now owns the comb layout and the fade wave as
plain functions with no Android dependencies, and HiveProgressView delegates to
it. Writing the trigonometry a second time for Compose would have let the two
renderers drift apart; this way they cannot.

overwatch-compose: a HiveProgress() composable drawing the same comb through
Canvas and rememberInfiniteTransition. Corner rounding is built into the path
with quadratics, since Compose applies a path effect only to strokes. There is
also a stateless overload taking the wave position, which makes the output a
pure function of its arguments -- that is what the screenshot tests pin, and it
lets callers drive the wave themselves. Unlike the View, it reports itself as an
indeterminate progress indicator to accessibility services.

AGP 9 has built-in Kotlin support, so org.jetbrains.kotlin.android must not be
applied; the Compose compiler plugin is pinned to 2.2.10 to match the
kotlin-gradle-plugin AGP bundles.

Tests: nine JVM tests over HiveGeometry, pinning the invariant the spacing
parameter exists to provide -- all six neighbours of the centre cell stay
equidistant -- plus that the comb never escapes its box, the radius never goes
negative, and the wave order is a permutation. Six Roborazzi screenshots cover
zero spacing, wide spacing, rounded corners, mid-wave and shrink.

CI assembles debug and release, lints, runs both test suites, and rehearses the
JitPack publish with -Pgroup/-Pversion so a broken release is caught before the
tag is cut. Release builds are what caught a debug-only tooling dependency
leaking into the demo's preview code.

The demo is now Compose, edge-to-edge, and renders both implementations from one
spacing slider so any divergence is visible side by side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@zjywill
zjywill merged commit 3d36812 into master Aug 11, 2026
2 checks passed
@zjywill
zjywill deleted the compose-api-and-ci branch August 11, 2026 06:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f8943c4c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/build.gradle.kts
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply the Android Kotlin plugin for Kotlin sources

This applies only the Compose compiler plugin, but neither this module nor :overwatch-compose applies org.jetbrains.kotlin.android. The Compose compiler plugin configures Kotlin compilations after the Kotlin plugin exists; it does not create Kotlin compile tasks, so the .kt files added in this commit (MainActivity.kt, HiveProgress.kt, and the screenshot tests) are not compiled/packaged, leaving the demo activity and the new Compose API missing from the build artifacts. Add the Android Kotlin plugin alias and apply it in both Kotlin-containing modules.

Useful? React with 👍 / 👎.

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