feat(ui): Steam Deck menu icons, and Compose previews rendered to PNGs (#2900)

* Rail and second-screen icons in the Steam Deck menu's style

Solid icons throughout the rail, and Steam's glyphs where Steam has the
same place: Library is the four-square grid, Stores the price tag,
Downloads the download arrow, Settings the gear. On the second screen,
Screenshots uses Steam's Media picture and Chat its Friends people.

* Compose previews of the launcher and the in-game menu, rendered to PNGs

Debug-only previews of the launcher on each tab and the in-game menu's
pages, built from the production composables with sample state and
no-op actions, at the Duo's handheld size and in portrait.
PreviewRenderTest draws each with Robolectric's native graphics into
app/build/preview-renders/, so a UI change can be looked at without a
device, and fails on a preview that throws or draws nothing.
docs/compose-previews.md says how to run and extend them.

* Preview renders wait for store accounts before drawing

A preview case can name what the render test waits for. The Library and
Stores cases wait for store accounts, which load on a background thread,
so their PNGs never catch the loading state.

* Preview renders step the paused clock while waiting for a case to be ready
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-19 19:12:10 -05:00
1 parent df48a85a71
commit d4af37937a
8 files changed
+266 -51

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
# Compose previews
Previews show production composables with sample data, without a device, the Linux runtime or a network. Use them in two
ways:
- **Android Studio:** select the `debug` build variant and open `app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt`
in Split or Design view.
- **Rendered to PNG files**, with no Studio or device needed (also how an agent can look at a UI change):
```sh
./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*PreviewRenderTest'
```
Each preview is drawn with Robolectric's native graphics at handheld (960x540 dp at xhdpi, the Duo's top screen,
1920x1080 px) and portrait (540x960 dp) sizes, into `app/build/preview-renders/{handheld,portrait}/<case>.png`. The test
fails if a preview throws, or draws a single flat colour.
## Files
| File | What |
| --- | --- |
| `app/src/debug/.../ui/PreviewSupport.kt` | `PreviewHost` (the production theme), `@DroidDeckPreviews` (the two sizes), sample `FrontEndState`, no-op `FrontEndActions` and `DrawerActions`, sample games |
| `app/src/debug/.../ui/LauncherPreviews.kt` | The previews, and `previewCases`, the list the render test draws |
| `app/src/testDebug/.../ui/PreviewRenderTest.kt` | The render test |
Previews cover the launcher on each tab (Steam, Library, Library with no games, Stores, Downloads, Settings, Settings with
no runtime) and the in-game menu's pages (Controller, Display, HUD, Session, and the Desktop menu).
## Adding one
Write the preview in `LauncherPreviews.kt` (or a new file beside it) with `@DroidDeckPreviews`, wrapping the content in
`PreviewHost`. Add a `PreviewCase` to `previewCases` so it is rendered and checked too. The launcher opens on a tab via
`sampleState(navigate = "<tab key>")`.
Everything here is in the debug source sets, so none of it ships in release builds. Sample art is left out, so cards use
their fallback gradients. Previews check layout and look; they do not exercise launching, input or the runtime.