Add pluggable AnimationTime clock for animations#4816
Merged
Conversation
Introduces a final AnimationTime class with a static now()/setTime/reset API that defaults to System.currentTimeMillis() but can be overridden with an explicit value. Routes Motion, Timeline, MorphAnimation, Image.animate and Label tickers through it so animations can be driven deterministically for tests, slow-motion, fast-forward, or manual frame stepping — without the previous Motion.slowMotion hack being the only lever. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
|
Compared 37 screenshots: 37 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Ant/javac on CI compiles with the platform default encoding (ASCII), so the em-dash in the class-level comment failed with "unmappable character for encoding ASCII". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
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.

Summary
final AnimationTimeclass incom.codename1.ui.animationswith a staticnow()/setTime(long)/reset()/isOverridden()API. Defaults toSystem.currentTimeMillis(); when overridden,now()returns the explicit value untilreset(). Primitive-only state (onelong, oneboolean) to keep the hot path cheap.Motion(start/finish/getCurrentMotionTime/createDecelerationMotionFrom),Timeline(setTime/animate),Container.MorphAnimation,Image.animate(), andLabeltext ticker.Motion.slowMotionhack as the only lever.Non-animation
System.currentTimeMillis()call sites (Display transition lock-wait, gesture/tap detection in Switch/MapComponent/Spinner, UITimer, etc.) are intentionally left alone.Test plan
mvn -pl core compile— 702 sources, BUILD SUCCESSAnimationTimeTest(8 cases) covers the static API plus integration assertions thatMotion.start()/finish()/getCurrentMotionTime()/getValue()/isFinished()andTimeline.animate()honor the overridecom.codename1.ui.animations.*Testsuite — 35/35 green (8 new + 27 pre-existing untouched)🤖 Generated with Claude Code