Repository navigation
Conversation
- Register 10 AnimationQuickGuide.kt snippets in SnippetRegistry (with a 768x432 AnimationPreviewFrame) and pull that file, plus util/ImageLoadingSampleUtils.kt, into the wasm build. - Add PreviewRecordings (generator tests): per-snippet PreviewStep scripts (Wait, Click, Press). PreviewScreenshotTest.record() plays them with recordRoboVideo and writes screenshots/<region_tag>.gif, the static DAC preview for animation snippets. - Support R.drawable/R.string in the wasm build: generateSnippetResources copies the referenced resources into Compose Multiplatform resources and generates a matching R (ResStubs.kt maps painterResource/stringResource). - Make AnimationQuickGuide.kt multiplatform: Coil 3 instead of Coil 2, route the navigation example by photo index instead of java.net URL encoding, and draw the back arrow from a vector drawable instead of material-icons. - Give the generator test 4 GB of heap for GIF encoding.
97ed22f to
e39d77d
Compare
⚡ Jetpack Compose Performance Review1. Missing
|
Use NavDisplay with per-entry NavDisplay.TransitionKey/PopTransitionKey metadata instead of NavHost enterTransition/exitTransition. The wasm build now depends on JetBrains' multiplatform navigation3-ui instead of navigation-compose.
…animations # Conflicts: # compose/snippets/build.gradle.kts # compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt # gradle/libs.versions.toml
- Fail the screenshot test setup if SnippetRecordings has IDs that aren't in SnippetRegistry, or recorded snippets without a SnippetPreviewFrames entry. - Navigation 3 snippet: add predictive back transitions (predictivePopTransitionSpec and NavDisplay.PredictivePopTransitionKey), ignore repeated taps during transitions so the back stack can't empty, and note rememberNavBackStack for surviving configuration changes. - Use named RoboVideoOptions arguments and explain settleTimeoutMillis = 0. - Click the snippet's only clickable node (onNode) so a second clickable node fails instead of recording a still GIF. - Record the animated content GIF at 0.35x (537x302, 2.0 MB, was 3.8 MB). - Declare the screenshots directory as a test output for the build cache. - Look for drawables in every drawable-* directory. - Fix the SnippetPreviewFrames KDoc placement.
|
Here is the summary of changes. You are about to add 1 region tag.
You are about to delete 1 region tag.
This comment is generated by snippet-bot.
|
⚡ Jetpack Compose Performance ReviewFinding: Missing
|
GIFs of the animation snippets were either large (5.7 MB for animated content at full size) or blurry when scaled down. Record every preview at full size and 25 fps, then convert the GIFs from recordRoboVideo to H.264 MP4s with a new encodePreviewVideos task (ffmpeg, preinstalled on GitHub's Ubuntu runners), which runs after recordRoborazziDebug and deletes the GIFs. All 10 recordings are 1536x864 at 25 fps and total about 455 KB (animated content: 327 KB). DAC shows them as looping, muted videos with the PNG screenshot as the poster.
⚡ Jetpack Compose Performance ReviewFinding 1: Missing
|
⚡ Jetpack Compose Performance ReviewFinding: Missing
|
⚡ Jetpack Compose Performance ReviewFinding 1: Missing
|
⚡ Jetpack Compose Performance ReviewNo Jetpack Compose performance issues were found in the changed code. Summary of Reviewed Changes
|
Adds interactive previews for the animation quick guide, with animated MP4 recordings as the static preview instead of PNG screenshots. Based on
main, so it doesn't depend on the Material component PRs (#1191, #1193).MP4 recordings
PreviewRecordings.ktin the generator tests. For each animation snippet,SnippetRecordingsholds a short script ofPreviewSteps (Wait,Click,Press) that triggers its animation and returns to the starting state, so the video loops.PreviewScreenshotTest.record()plays the script with Roborazzi'srecordRoboVideoat 25 fps and full resolution. Roborazzi can only write animated images, so a newencodePreviewVideostask (run afterrecordRoborazziDebug) converts each recording withffmpegto an H.264screenshots/<region_tag>.mp4(crf 23, faststart, bit-exact) and deletes the intermediate GIF. The MP4 is deployed to GitHub Pages with the screenshots, and DAC syncs it as the static preview, with the PNG screenshot as its poster.ffmpegon thePATH. The deploy-preview-pages workflow installs it withapt-get, and the README tells contributors to install it locally.AnimationPreviewFrame, because they're written for a phone-sized screen (for example a box that grows from 200dp to 400dp). Videos are 1536x864 px (the frame at 2x density).recordRoboVideokeeps every frame in memory until it's encoded.Snippets enabled (10)
cookbook_visibility,cookbook_visibility_alpha,animation_size_change,animation_offset_change,animation_layout_offset,animation_padding,cookbook_elevation,cookbook_text,cookbook_text_colorandcookbook_animated_content.Not enabled: the snippets that don't draw anything on their own (background color, infinitely repeating, launch, sequential and concurrent animations), and the navigation example (network images). Their pages keep the existing figures.
Making
AnimationQuickGuide.ktcompile for wasmgenerateSnippetResourcescopies theR.drawable.*/R.string.*resources the pulled snippets reference into Compose Multiplatform resources and generates a matchingR.ResStubs.ktbackspainterResource/stringResourcewith them. This is the same mechanism as in [2/3] Interactive Compose previews: enable component snippets #1191, so the two PRs merge cleanly in either order.main(Migrate the Compose snippets from Coil 2 to Coil 3 #1216). This PR only adds the web side of the network stack:coil-network-ktor3with the Ktor JS engine.android_compose_animate_destinations) is migrated to Navigation 3. It usesNavDisplaywith amutableStateListOf<Any>back stack, andLanding/Detail(photoIndex)keys. Detail overrides the transitions withNavDisplay.TransitionKey/PopTransitionKeymetadata, which replacesenterTransition/exitTransitionon aNavHostcomposable. Passing the photo index in the key also removes thejava.netURL encoding. The DAC prose for that section is updated in the CL.ic_arrow_back.xmlvector drawable instead ofIcons.Default.ArrowBack, so the wasm build doesn't need the material-icons library.ui-tooling-preview(for@Preview) andcomponents-resources, plus JetBrains' multiplatformnavigation3-ui(1.2.0; Android usesandroidx.navigation31.2.0-beta01).Testing
./gradlew :preview:wasm:compileKotlinWasmJs :preview:generator:compileDebugUnitTestKotlin :compose:snippets:compileDebugKotlinall pass.recordRoborazziDebugpasses for all 15 snippets (the 5 buttons and the 10 animation snippets). and logsEncoded 10 preview recording(s). The 10 MP4s total about 455 KB (1536x864, 25 fps); the largest is animated content at 327 KB. I checked frames from the videos and they are sharp.prefers-reduced-motion: reduceit stays paused on the first frame.DAC change: cl/1005450674 (staged at https://android.devsite.corp.google.com/develop/ui/compose/animation/quick-guide).