Add a Compose API, screenshot tests and CI - #8
Conversation
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>
|
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. |
There was a problem hiding this comment.
💡 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".
| @@ -1,5 +1,6 @@ | |||
| plugins { | |||
| alias(libs.plugins.android.application) | |||
| alias(libs.plugins.kotlin.compose) | |||
There was a problem hiding this comment.
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 👍 / 👎.
Compose is the reason a new project would or would not pick this library up, and there was no CI to notice that
masterhad been unbuildable since1.6.Shared geometry
HiveGeometrynow owns the comb layout and the fade wave as plain functions with no Android dependencies, andHiveProgressViewdelegates to it. Writing the trigonometry a second time for Compose would have let the two renderers drift apart; this way they cannot.overwatch-composeA
HiveProgress()composable drawing the same comb throughCanvasandrememberInfiniteTransition. Two things worth calling out:PathEffectonly to strokes —CornerPathEffecthas no fill equivalent.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.androidmust not be applied — it now fails the build outright. The Compose compiler plugin is pinned to2.2.10to match thekotlin-gradle-pluginAGP 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/-Pversionso 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
debugImplementationtooling dependency leaking into the demo's@Previewcode, whichassembleDebughappily 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.0coordinate. 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 the2.1.0build log before the README claims them.🤖 Generated with Claude Code