mobileui-os 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/AGENTS.md +13 -0
  2. package/CHANGELOG.md +30 -17
  3. package/LICENSE +21 -0
  4. package/README.md +63 -18
  5. package/bin/cli.mjs +157 -211
  6. package/bin/generate.mjs +216 -0
  7. package/knowledge/INDEX.md +118 -0
  8. package/knowledge/android/00-android-reading-protocol.md +48 -0
  9. package/knowledge/android/01-android-decision-framework.md +58 -0
  10. package/knowledge/android/02-android-information-architecture.md +76 -0
  11. package/knowledge/android/03-android-interaction-and-state-engineering.md +87 -0
  12. package/knowledge/android/04-android-visual-system-and-theming.md +77 -0
  13. package/knowledge/android/05-android-implementation-and-refactoring.md +80 -0
  14. package/knowledge/android/06-android-qa-and-audit-loop.md +82 -0
  15. package/knowledge/android/adaptive-and-tablets.md +83 -0
  16. package/knowledge/android/forms-and-input.md +91 -0
  17. package/knowledge/android/gestures.md +81 -0
  18. package/knowledge/android/lists-and-data-heavy.md +88 -0
  19. package/knowledge/android/motion.md +71 -0
  20. package/knowledge/android/notifications-and-permissions.md +89 -0
  21. package/knowledge/android/performance.md +93 -0
  22. package/knowledge/android/search-and-discovery.md +84 -0
  23. package/knowledge/android/sheets-dialogs-and-menus.md +94 -0
  24. package/knowledge/android/states-and-recovery.md +85 -0
  25. package/knowledge/android/typography.md +74 -0
  26. package/knowledge/android/visual-qa.md +93 -0
  27. package/knowledge/android/worked-examples-lists-and-navigation.md +143 -0
  28. package/knowledge/android/worked-examples-permissions-and-adaptive.md +133 -0
  29. package/knowledge/android/worked-examples-state-and-forms.md +156 -0
  30. package/package.json +7 -4
  31. package/principles/platform-principles.md +3 -3
  32. package/scripts/sync-platform-adapters.mjs +23 -0
  33. package/scripts/sync-platform-adapters.ps1 +30 -0
  34. package/skills/accessibility-engineer/SKILL.md +5 -0
  35. package/skills/analytics-engineer/SKILL.md +5 -0
  36. package/skills/animation-engineer/SKILL.md +5 -0
  37. package/skills/component-designer/SKILL.md +5 -0
  38. package/skills/component-library-engineer/SKILL.md +8 -1
  39. package/skills/component-library-ops/SKILL.md +9 -2
  40. package/skills/design-system/SKILL.md +5 -0
  41. package/skills/design-token-engineer/SKILL.md +7 -0
  42. package/skills/design-token-pipeline/SKILL.md +7 -0
  43. package/skills/device-lab-engineer/SKILL.md +5 -0
  44. package/skills/forms-engineer/SKILL.md +5 -0
  45. package/skills/internationalization-engineer/SKILL.md +5 -0
  46. package/skills/motion-designer/SKILL.md +5 -0
  47. package/skills/native-data-fetching/SKILL.md +5 -0
  48. package/skills/navigation-architect/SKILL.md +5 -0
  49. package/skills/performance-engineer/SKILL.md +5 -0
  50. package/skills/platform-specialist/SKILL.md +5 -0
  51. package/skills/pre-release-gate/SKILL.md +5 -0
  52. package/skills/screen-designer/SKILL.md +5 -0
  53. package/skills/security-engineer/SKILL.md +5 -0
  54. package/skills/skill-router/SKILL.md +82 -0
  55. package/skills/skills.json +139 -134
  56. package/skills/testing-auditor/SKILL.md +5 -0
  57. package/skills/ui-architect/SKILL.md +5 -0
  58. package/skills/ui-implementer/SKILL.md +5 -0
  59. package/skills/ux-architect/SKILL.md +5 -0
  60. package/skills/ux-auditor/SKILL.md +5 -0
  61. package/skills/visual-auditor/SKILL.md +5 -0
  62. package/workflows/new-screen.md +2 -0
  63. package/workflows/pre-release.md +2 -0
  64. package/workflows/redesign.md +2 -0
  65. package/workflows/ui-audit.md +2 -0
@@ -0,0 +1,93 @@
1
+ # Android Performance
2
+
3
+ Performance is a UX requirement. Budget it per screen and enforce it in CI, not after users complain.
4
+
5
+ ## Budgets
6
+
7
+ | Metric | Target |
8
+ |--------|--------|
9
+ | Cold start to first usable frame | < 2s on reference mid-tier device |
10
+ | Frame time | < 16.67ms (60Hz), < 8.3ms (120Hz) |
11
+ | Janky frames | < 1% during scroll and navigation |
12
+ | Network to content | < 1s on warm cache, with skeleton immediately |
13
+ | APK/ABI size growth | Review every release; no unbounded growth |
14
+
15
+ Measure on a low-end reference device, not only a flagship.
16
+
17
+ ## Startup
18
+
19
+ - Defer non-critical initialization (analytics, remote config, feature flags) until after first frame.
20
+ - Avoid heavy work in `Application.onCreate` and in top-level composable lambdas.
21
+ - Use Baseline Profiles and, where applicable, startup profiles to reduce JIT at launch.
22
+ - Keep the first screen's data payload small; render a skeleton while the rest loads.
23
+ - Avoid synchronous disk reads or SharedPreferences on the main thread.
24
+
25
+ ## Rendering and recomposition (Compose)
26
+
27
+ - Keep composition stable: avoid unstable lambdas and allocating new objects in hot paths.
28
+ - Use `key` and `contentType` in lazy lists; use `derivedStateOf` for scroll-derived state.
29
+ - Hoist state to where it is needed; avoid reading frequently changing state high in the tree.
30
+ - Prefer `remember` over repeated expensive calculations; dispose effects correctly.
31
+ - Track recomposition counts with the Compose compiler metrics / Layout Inspector.
32
+
33
+ ## Views and general
34
+
35
+ - Flatten deep view hierarchies; use `ConstraintLayout` or Compose where nesting is excessive.
36
+ - Reuse view holders; never inflate in `onBind`.
37
+ - Batch notifications of data changes; avoid repeated full adapter diffs.
38
+ - Avoid overdraw; clip and cull offscreen content.
39
+
40
+ ## Images and media
41
+
42
+ - Use a caching image library with correct sizing and `contentScale`.
43
+ - Request images near the displayed size; avoid decoding full-resolution assets into small thumbnails.
44
+ - Specify aspect ratios to prevent layout shifts.
45
+ - Pause animations and video when offscreen or in battery saver.
46
+
47
+ ## Network and battery
48
+
49
+ - Combine requests where sensible; cache aggressively with explicit freshness policy.
50
+ - Cancel in-flight work when the screen leaves; respect lifecycle scopes.
51
+ - Batch and defer non-urgent work with WorkManager; honor Doze and battery saver.
52
+ - Avoid wake locks unless strictly required; release them on every path.
53
+
54
+ ## Profiling tools
55
+
56
+ | Tool | Use |
57
+ |------|-----|
58
+ | Android Studio Profiler (CPU) | Trace method and frame time |
59
+ | System Trace / Perfetto | Frame timeline, jank, thread contention |
60
+ | Layout Inspector | Compose hierarchy and recompositions |
61
+ | Baseline Profile generator | Startup and navigation profiles |
62
+ | Benchmark macro | Automated startup and jank regressions |
63
+ | Battery Historian | Wake locks, network and background work |
64
+
65
+ ## Required states
66
+
67
+ - Loading shows a skeleton immediately; no blank frame while waiting for data.
68
+ - Errors and retries do not restart the whole screen or lose scroll position.
69
+ - Offline uses cached data rather than blocking indefinitely.
70
+
71
+ ## Platform notes (iOS → Android)
72
+
73
+ | iOS | Android |
74
+ |-----|---------|
75
+ | Instruments Time Profiler | Android Studio Profiler / Perfetto |
76
+ | Core Data / URLCache | Room + OkHttp cache |
77
+ | Pre-main optimization | Baseline Profiles / startup profile |
78
+ | ImageIO downsampling | Coil/Glide sizing + `contentScale` |
79
+ | Background tasks | WorkManager with constraints |
80
+
81
+ ## Anti-patterns
82
+
83
+ - Measuring only on a flagship device.
84
+ - Unstable list keys causing full recomposition on scroll.
85
+ - Blocking the main thread with JSON parsing or database writes.
86
+ - Animating layout-affecting properties.
87
+ - Network retries without backoff or cancellation.
88
+
89
+ ## Related skills
90
+
91
+ - `skills/performance-engineer/SKILL.md`
92
+ - `skills/device-lab-engineer/SKILL.md`
93
+ - `skills/testing-auditor/SKILL.md`
@@ -0,0 +1,84 @@
1
+ # Android Search and Discovery
2
+
3
+ Search is a shortcut to a known goal, not a substitute for good information architecture. Keep the query visible, results explainable and failure recoverable.
4
+
5
+ ## Entry points
6
+
7
+ | Surface | Use |
8
+ |---------|-----|
9
+ | SearchView in top app bar | Primary search for a content screen |
10
+ | Search affordance in list header | Search scoped to that list |
11
+ | Dedicated search screen | Cross-content or multi-filter search |
12
+ | Assistant / voice input | Optional supplementary input |
13
+
14
+ - The search field is persistent while results are shown; never replace it with a static title.
15
+ - Preserve the query across rotation and navigation back.
16
+ - On compact screens, an icon expands into the field; focus and keyboard open immediately.
17
+
18
+ ## Query behavior
19
+
20
+ | Behavior | Guidance |
21
+ |----------|----------|
22
+ | Suggestions | Recent searches first, then popular/contextual; label sections |
23
+ | Typing | Debounce network queries (~250–300ms); show local suggestions instantly |
24
+ | Autocomplete | Keep the user's typed text; do not silently rewrite it |
25
+ | Submit | IME Search action; keep keyboard open until results are shown |
26
+ | Filters | Expose as chips or a sheet; show active count and Clear all |
27
+ | History | Allow per-item delete and clear-all; respect privacy expectations |
28
+
29
+ ## Result states
30
+
31
+ | State | Visual | Recovery |
32
+ |-------|--------|----------|
33
+ | Initial | Recent searches + suggestions | Tap or type |
34
+ | Loading | Skeleton rows | — |
35
+ | Results | Ranked list with matched terms emphasized | Refine filters |
36
+ | No results | "No results for 'X'" + suggestions | Clear filters, check spelling, browse |
37
+ | Error | Inline banner | Retry |
38
+ | Offline | Cached/recent results + banner | Retry when online |
39
+
40
+ Never show a blank screen for zero results, and never silently widen the query without saying so.
41
+
42
+ ## Result rows
43
+
44
+ - Show the field that matched (title, content, author) so relevance is understandable.
45
+ - Highlight matched text without relying on color alone (use bold or background plus semantics).
46
+ - Keep row actions consistent with the rest of the app; one primary action per row.
47
+ - Support keyboard/IME navigation through results where practical.
48
+
49
+ ## Voice and locale
50
+
51
+ - Voice input uses the system IME action; do not build a separate microphone unless it adds value.
52
+ - Search is locale-aware: normalization, case folding and diacritics matter.
53
+ - In RTL, the search field, magnifier and clear icon follow reading direction; the query's direction follows its script.
54
+
55
+ ## Accessibility
56
+
57
+ - Search field has an explicit label ("Search messages"), not only an icon.
58
+ - Clear button is labelled and reachable at 48dp.
59
+ - Suggestions and results are announced in order; result count is announced after loading.
60
+ - Highlighting is accompanied by text or semantic markup, not color alone.
61
+
62
+ ## Platform notes (iOS → Android)
63
+
64
+ | iOS | Android |
65
+ |-----|---------|
66
+ | UISearchController | `SearchBar` / `SearchView` in top app bar |
67
+ | Suggestions | Recent queries + suggestions adapter |
68
+ | Scope bar | Filter chips / bottom sheet |
69
+ | Voice search | IME voice input / Assistant |
70
+ | Cancel button | Clear query + IME close |
71
+
72
+ ## Anti-patterns
73
+
74
+ - Hiding the query behind a results title.
75
+ - Clearing the field after every search.
76
+ - Empty screen for no results.
77
+ - Unbounded query history with no delete control.
78
+ - Filter state lost on rotation.
79
+
80
+ ## Related skills
81
+
82
+ - `skills/ui-architect/SKILL.md`
83
+ - `skills/native-data-fetching/SKILL.md`
84
+ - `skills/internationalization-engineer/SKILL.md`
@@ -0,0 +1,94 @@
1
+ # Android Sheets, Dialogs and Menus
2
+
3
+ Choose the presentation by **how much commitment and context** the interaction requires. Android users expect system back to dismiss transient surfaces.
4
+
5
+ ## Decision table
6
+
7
+ | Need | Surface |
8
+ |------|---------|
9
+ | Short contextual choice, dismissable | Bottom sheet (standard) |
10
+ | Multi-step task needing app context | Modal bottom sheet |
11
+ | Critical confirmation with irreversible result | Dialog |
12
+ | Small set of actions tied to an item | Dropdown menu |
13
+ | Navigation to a destination | Route / screen, not a dialog |
14
+ | Transient feedback | Snackbar, not a dialog |
15
+
16
+ ## Bottom sheets
17
+
18
+ - **Standard sheet**: peeking content, dismiss by swipe down, back, or scrim tap.
19
+ - **Modal sheet**: blocks the underlying screen; use `skipPartiallyExpanded` when there is no meaningful peek state.
20
+ - Provide a drag handle only when the sheet is actually draggable.
21
+ - Set an explicit initial state (hidden, partially expanded, expanded) and handle configuration changes.
22
+ - On back, collapse before closing when a partially expanded state exists.
23
+ - Content inside a sheet scrolls independently; do not nest a second sheet without a strong reason.
24
+
25
+ ## Dialogs
26
+
27
+ | Type | Use |
28
+ |------|-----|
29
+ | Confirmation | Destructive or irreversible actions; clear consequence and Cancel |
30
+ | Input | One or two short fields; longer forms belong on a screen |
31
+ | Alert | Information the user must acknowledge |
32
+ | Permission rationale | Explain benefit, then request via the system permission flow |
33
+
34
+ Rules:
35
+ - Title states the decision; body states the consequence.
36
+ - Buttons use verb phrases: "Delete" / "Cancel", not "OK" / "No".
37
+ - Destructive action is not the default focused action.
38
+ - Never stack dialogs; never use a dialog for a loading state.
39
+ - Dismiss on back and scrim tap unless the action is truly blocking.
40
+
41
+ ## Menus
42
+
43
+ - Top app bar overflow for rarely used actions; inline icons for frequent ones.
44
+ - Group related items, put destructive items last, and separate them visually.
45
+ - Menu labels are short verbs; icons are optional and never the only label.
46
+ - Contextual action mode replaces the top app bar during selection; back exits selection.
47
+
48
+ ## Snackbars
49
+
50
+ - One line of text plus at most one action ("Undo", "Retry").
51
+ - Do not stack more than one; replace the current message.
52
+ - Keep the underlying task available; a snackbar must never be the only way to recover.
53
+
54
+ ## Required states
55
+
56
+ | State | Behavior |
57
+ |-------|----------|
58
+ | Opening | Enter from expected edge, focus moves into surface |
59
+ | Content | Scrollable, with clear title and close affordance |
60
+ | Loading | Inline progress; keep dismiss allowed if safe |
61
+ | Error | Inline message with retry; do not close the sheet |
62
+ | Success | Close and confirm with a snackbar where useful |
63
+ | Dismissed | Restore focus to the triggering control |
64
+
65
+ ## Accessibility
66
+
67
+ - Focus is moved into the sheet/dialog on open and returned to the trigger on dismiss.
68
+ - TalkBack treats modal surfaces as a focus boundary; underlying content is not reachable.
69
+ - Every close affordance is labelled; scrim-only dismissal is not enough.
70
+ - Touch targets ≥ 48dp; text scales to 200% without clipping buttons.
71
+
72
+ ## Platform notes (iOS → Android)
73
+
74
+ | iOS | Android |
75
+ |-----|---------|
76
+ | Sheet detents | Bottom sheet states with `skipPartiallyExpanded` |
77
+ | `UIAlertController` | `AlertDialog` / custom dialog |
78
+ | Action sheet | Bottom sheet or dropdown menu |
79
+ | Tap outside to dismiss | Scrim tap + system back |
80
+ | Toast | Snackbar with optional action |
81
+
82
+ ## Anti-patterns
83
+
84
+ - Dialog for a multi-screen flow.
85
+ - Sheet that cannot be dismissed by back.
86
+ - Destructive action as the highlighted default.
87
+ - Menu with more than ~6 items and no grouping.
88
+ - Snackbar carrying critical information with no persistent alternative.
89
+
90
+ ## Related skills
91
+
92
+ - `skills/ui-architect/SKILL.md`
93
+ - `skills/platform-specialist/SKILL.md`
94
+ - `skills/accessibility-engineer/SKILL.md`
@@ -0,0 +1,85 @@
1
+ # Android States and Recovery
2
+
3
+ Every screen must define all meaningful states before implementation. A state is not complete unless it tells the user what happened and what they can do next.
4
+
5
+ ## Required state matrix
6
+
7
+ | State | Trigger | Visual | Action | Recovery |
8
+ |-------|---------|--------|--------|----------|
9
+ | Loading | Initial fetch | Skeleton matching final layout | None | Auto → content/error |
10
+ | Empty | No data yet | Illustration + plain copy + primary CTA | Create/import | User acts |
11
+ | Content | Success | Full layout | Normal interactions | — |
12
+ | Error | Network/server | Inline banner + message | Retry, help | One-tap retry |
13
+ | Offline | No connectivity | Cached content + offline banner | Queue writes | Auto-sync on reconnect |
14
+ | Permission | Denied | Explanation + reason + settings link | Grant | Refetch on return |
15
+ | Partial | Degraded response | Available sections + placeholders | Degraded interactions | Fill gaps progressively |
16
+ | Success | Mutation completed | Snackbar or inline confirmation | Undo where possible | One-tap undo |
17
+ | Disabled | Precondition unmet | Disabled control + nearby reason | — | Meet precondition |
18
+
19
+ ## Loading
20
+
21
+ - Use **skeletons that mirror final row and region geometry**; avoid a generic centered spinner for content screens.
22
+ - Keep navigation and persistent UI present during loading so context is not lost.
23
+ - For refresh, keep existing content visible and show a compact progress indicator.
24
+ - Buttons with an in-flight action show a spinner and become non-interactive; never silently do nothing.
25
+
26
+ ## Empty
27
+
28
+ An empty state must answer three questions:
29
+ 1. Why is it empty? ("No saved items yet.")
30
+ 2. What will appear here? ("Trips you save will show up here.")
31
+ 3. What can I do now? Primary action plus, optionally, a secondary action.
32
+
33
+ Do not reuse the empty illustration for an error or a filtered-to-zero result. A filtered-empty state should offer **Clear filters**.
34
+
35
+ ## Error and retry
36
+
37
+ - Message = cause + effect + next step. "Couldn't load messages. Check your connection and try again."
38
+ - Keep partial data on screen; do not replace the whole screen with an error.
39
+ - Retry is one tap and idempotent; show progress while retrying.
40
+ - Distinguish retryable errors (network, timeout) from permanent ones (404, permission) — do not offer Retry for a deleted resource.
41
+ - For form submissions, preserve every entered value.
42
+
43
+ ## Offline
44
+
45
+ - Show a single persistent offline banner using connectivity state; do not stack one per screen.
46
+ - Serve cached content and mark stale data clearly.
47
+ - Queue writes with visible pending state; reconcile on reconnect and surface conflicts explicitly.
48
+ - Never present a queued write as completed.
49
+
50
+ ## Permission
51
+
52
+ - Request in context, at the moment of need, with a short rationale before the system dialog.
53
+ - If denied, explain what is unavailable and offer **Open settings**; do not re-prompt on every visit.
54
+ - On return from settings, re-check the permission and resume the interrupted task automatically.
55
+
56
+ ## Platform notes (iOS → Android)
57
+
58
+ | iOS | Android |
59
+ |-----|---------|
60
+ | Pull-to-refresh spinner | `PullToRefreshBox` / SwipeRefreshLayout |
61
+ | Alert for errors | Inline banner + Snackbar |
62
+ | Settings deep link | `Settings.ACTION_APPLICATION_DETAILS_SETTINGS` |
63
+ | Reachability banner | ConnectivityManager / connectivity state flow |
64
+ | Restore from background | Remember state via `rememberSaveable` / ViewModel |
65
+
66
+ ## Accessibility
67
+
68
+ - Announce state changes with a live region; skeletons are `importantForAccessibility="no"` until replaced.
69
+ - Error messages are associated with their field or region and announced once.
70
+ - Offline and permission states are exposed as text, not only an icon.
71
+ - Retry and Undo actions have explicit labels and 48dp targets.
72
+
73
+ ## Anti-patterns
74
+
75
+ - Blank screen while loading.
76
+ - Generic "Something went wrong" with no recovery.
77
+ - Empty state used for an error.
78
+ - Offline state hidden until an action fails.
79
+ - Retry that clears the user's work.
80
+
81
+ ## Related skills
82
+
83
+ - `skills/native-data-fetching/SKILL.md`
84
+ - `skills/ui-implementer/SKILL.md`
85
+ - `skills/visual-auditor/SKILL.md`
@@ -0,0 +1,74 @@
1
+ # Android Typography
2
+
3
+ Typography on Android must survive system font scaling, custom OEM fonts, localization and RTL. The Material 3 type scale is a starting point, not a substitute for hierarchy.
4
+
5
+ ## Units and scaling
6
+
7
+ - Always use **sp** for text and **dp** for dimensions. Never use px.
8
+ - Text respects the user's font size setting; design for up to **200% scaling** without clipping or overlap.
9
+ - Use `minLines`/`maxLines` deliberately; prefer wrapping over ellipsis for meaningful content.
10
+ - Set line height explicitly via `lineHeight` in the type style; do not rely on default font metrics.
11
+ - Avoid `fontScale` overrides in app code — they break user intent and accessibility.
12
+
13
+ ## Hierarchy rules
14
+
15
+ | Level | Use | Guidance |
16
+ |-------|-----|----------|
17
+ | Headline | Screen title, hero | One per screen; short |
18
+ | Title | Section header | Consistent across screens |
19
+ | Body | Primary reading text | Default 16sp for long content |
20
+ | Label | Controls, buttons, tabs | Uppercase only for short overlines |
21
+
22
+ - Establish hierarchy through **size, weight and spacing**, not color alone.
23
+ - Keep line length comfortable (~60–80 characters) on tablets.
24
+ - Use semantic styles from the token system (`typography.body`, `typography.heading`) rather than ad-hoc `fontSize` values.
25
+
26
+ ## Truncation and overflow
27
+
28
+ | Situation | Behavior |
29
+ |-----------|----------|
30
+ | List row title | Two lines max, ellipsis, full value in detail |
31
+ | Button label | Wrap only if unavoidable; prefer shorter copy |
32
+ | Form label | Never truncate; grow the field |
33
+ | Date/time | Use `formatDateTime` for locale, not a hard-coded pattern |
34
+ | Numbers/currency | Use `NumberFormat`/`Currency` for locale |
35
+
36
+ Never rely on a fixed-height container for text. Let it grow and adapt surrounding layout.
37
+
38
+ ## Localization and RTL
39
+
40
+ - Use string resources with placeholders (`%1$s`) rather than concatenating.
41
+ - Support plural resources for counted items.
42
+ - In RTL, alignment follows reading direction (`start`/`end`, not `left`/`right`).
43
+ - Icons representing direction are mirrored; logos and numeric progress are not.
44
+ - Test with a long-language locale (e.g. German) and an RTL locale (Arabic/Hebrew) at 200% scale.
45
+
46
+ ## Platform notes (iOS → Android)
47
+
48
+ | iOS | Android |
49
+ |-----|---------|
50
+ | Dynamic Type | System font scale in sp |
51
+ | SF Pro | Roboto / system font, or product font with fallback |
52
+ | UIFont.TextStyle | Material 3 typography roles / token styles |
53
+ | Baseline adjustment | `lineHeight` + baseline alignment in Compose |
54
+
55
+ ## Accessibility
56
+
57
+ - Minimum body text 14sp; prefer 16sp for sustained reading.
58
+ - Contrast ≥ 4.5:1 for normal text and ≥ 3:1 for large text.
59
+ - TalkBack reads text in traversal order; avoid splitting a sentence across unrelated composables.
60
+ - Do not use text in images for essential information.
61
+
62
+ ## Anti-patterns
63
+
64
+ - Hard-coded `sp` values in components instead of tokens.
65
+ - Placeholder-only labels or icon-only buttons.
66
+ - Uppercase paragraphs.
67
+ - Fixed-height text containers.
68
+ - Layout that breaks at 200% font scale.
69
+
70
+ ## Related skills
71
+
72
+ - `skills/design-system/SKILL.md`
73
+ - `skills/internationalization-engineer/SKILL.md`
74
+ - `skills/accessibility-engineer/SKILL.md`
@@ -0,0 +1,93 @@
1
+ # Android Visual QA and Validation
2
+
3
+ Visual QA verifies that the implementation holds up across devices, settings and states — not only on the designer's screen and the happy path.
4
+
5
+ ## Device matrix
6
+
7
+ | Tier | Examples | Purpose |
8
+ |------|----------|---------|
9
+ | Small compact | 360dp width, low RAM | Worst-case layout and performance |
10
+ | Reference compact | 393–412dp, mid-tier | Primary phone validation |
11
+ | Large compact / landscape | ~600dp width | Rotation and text scaling stress |
12
+ | Medium tablet | 600–840dp | Rail / two-pane behavior |
13
+ | Expanded tablet | ≥ 840dp | Multi-pane and content width |
14
+ | Foldable | Folded + unfolded | Posture continuity and hinge layout |
15
+
16
+ Test dark theme, 200% font scale, RTL, and reduced motion on at least the reference and small devices.
17
+
18
+ ## Screenshot and golden tests
19
+
20
+ - Capture key states per screen: loading, empty, content, error, offline, permission, success.
21
+ - Use deterministic data and freeze time/animations.
22
+ - Prefer semantic assertions alongside pixel diffs so a legitimate refactor is not treated as a regression.
23
+ - Run golden tests on a controlled emulator image; device differences cause false positives.
24
+
25
+ ## Manual inspection checklist
26
+
27
+ ### Structure
28
+ - [ ] One clear primary action per screen
29
+ - [ ] Hierarchy matches the screen specification
30
+ - [ ] No nested cards or decorative containers without purpose
31
+ - [ ] Regions adapt across size classes
32
+
33
+ ### Typography and spacing
34
+ - [ ] Semantic text styles, no ad-hoc sizes
35
+ - [ ] 4/8dp spacing rhythm
36
+ - [ ] No clipping at 200% font scale
37
+ - [ ] Line lengths remain readable on tablets
38
+
39
+ ### Color and state
40
+ - [ ] Contrast ≥ 4.5:1 for body text
41
+ - [ ] Meaning is not conveyed by color alone
42
+ - [ ] Light and dark themes both complete
43
+ - [ ] All states from the state matrix are present
44
+
45
+ ### Interaction and platform fit
46
+ - [ ] Touch targets ≥ 48dp
47
+ - [ ] Back works predictably, including sheets and selection
48
+ - [ ] Gestures have a non-gesture alternative
49
+ - [ ] Keyboard and IME actions are correct
50
+ - [ ] Sheets/dialogs restore focus on dismiss
51
+
52
+ ### Accessibility
53
+ - [ ] TalkBack traversal order matches visual order
54
+ - [ ] Labels, roles and state announcements are correct
55
+ - [ ] Reduced motion honored
56
+ - [ ] RTL layout mirrors correctly
57
+
58
+ ## Automated gates
59
+
60
+ | Check | Tool |
61
+ |-------|------|
62
+ | Layout and a11y lint | `AccessibilityScanner`, Compose lint, `uiautomator` assertions |
63
+ | Golden screenshots | Paparazzi / Roborazzi / Firebase Test Lab |
64
+ | Critical flows | Espresso / Compose Test / Maestro |
65
+ | Performance | Macrobenchmark, frame-time budget |
66
+ | Leaks | LeakCanary in debug builds |
67
+
68
+ Fail the build on critical and high severity findings; track medium/low with owners.
69
+
70
+ ## Reporting
71
+
72
+ Use `templates/audit-report.md`:
73
+ 1. Scorecard by category
74
+ 2. Critical / high / medium / low issues with screenshot evidence
75
+ 3. Concrete fix for each issue
76
+ 4. Re-audit result after fixes
77
+
78
+ Every issue must name the screen, state, device/configuration and expected behavior.
79
+
80
+ ## Anti-patterns
81
+
82
+ - QA only on the happy path.
83
+ - Pixel-perfect comparison across different devices.
84
+ - Ignoring dark mode, RTL or font scaling.
85
+ - Reporting "looks fine" without states and evidence.
86
+ - Shipping with critical issues because they are "design-only".
87
+
88
+ ## Related skills
89
+
90
+ - `skills/visual-auditor/SKILL.md`
91
+ - `skills/ux-auditor/SKILL.md`
92
+ - `skills/device-lab-engineer/SKILL.md`
93
+ - `skills/testing-auditor/SKILL.md`
@@ -0,0 +1,143 @@
1
+ # Android Worked Examples: Lists, Search and Navigation
2
+
3
+ Concrete Jetpack Compose examples for `lists-and-data-heavy.md`, `search-and-discovery.md` and `02-android-information-architecture.md`.
4
+
5
+ ## Lazy list with every state
6
+
7
+ ```kotlin
8
+ sealed interface FeedState {
9
+ data object Loading : FeedState
10
+ data object Empty : FeedState
11
+ data class Content(val items: List<Message>, val loadingMore: Boolean) : FeedState
12
+ data class Error(val message: String) : FeedState
13
+ }
14
+
15
+ @Composable
16
+ fun FeedList(state: FeedState, onRetry: () -> Unit, onLoadMore: () -> Unit) {
17
+ when (state) {
18
+ FeedState.Loading -> repeat(6) { MessageSkeleton() }
19
+ FeedState.Empty -> EmptyState(
20
+ title = "No messages",
21
+ body = "Messages you send will appear here.",
22
+ action = "Compose message" to { /* navigate */ },
23
+ )
24
+ is FeedState.Error -> ErrorState(message = state.message, onRetry = onRetry)
25
+ is FeedState.Content -> LazyColumn(
26
+ modifier = Modifier.fillMaxSize(),
27
+ contentPadding = PaddingValues(16.dp),
28
+ verticalArrangement = Arrangement.spacedBy(8.dp),
29
+ ) {
30
+ items(
31
+ items = state.items,
32
+ key = { it.id }, // stable key preserves scroll and state
33
+ contentType = { "message" }, // stable type for recycling
34
+ ) { message ->
35
+ MessageRow(
36
+ message = message,
37
+ modifier = Modifier
38
+ .fillMaxWidth()
39
+ .heightIn(min = 56.dp)
40
+ .clickable { /* open detail */ },
41
+ )
42
+ }
43
+ if (state.loadingMore) {
44
+ item(key = "footer") {
45
+ LinearProgressIndicator(Modifier.fillMaxWidth().padding(16.dp))
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ Notes: skeletons match row geometry, refresh keeps loaded rows, footer loads more without a full-screen blocker, and the empty state offers an action.
54
+
55
+ ## Search with debounce and result states
56
+
57
+ ```kotlin
58
+ @Composable
59
+ fun SearchScreen(viewModel: SearchViewModel) {
60
+ val query by viewModel.query.collectAsStateWithLifecycle()
61
+ val results by viewModel.results.collectAsStateWithLifecycle()
62
+
63
+ Column(Modifier.fillMaxSize()) {
64
+ SearchBar(
65
+ inputField = @Composable {
66
+ TextField(
67
+ value = query,
68
+ onValueChange = viewModel::onQueryChange, // debounced in the ViewModel
69
+ label = { Text("Search messages") },
70
+ singleLine = true,
71
+ trailingIcon = {
72
+ IconButton(onClick = { viewModel.onQueryChange("") }) {
73
+ Icon(Icons.Default.Close, contentDescription = "Clear search")
74
+ }
75
+ },
76
+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
77
+ modifier = Modifier.fillMaxWidth().heightIn(min = 48.dp),
78
+ )
79
+ },
80
+ expanded = false,
81
+ onExpandedChange = {},
82
+ ) {}
83
+
84
+ when {
85
+ query.isBlank() -> RecentSearches(items = viewModel.recent, onPick = viewModel::onQueryChange)
86
+ results.isEmpty() -> EmptyState(
87
+ title = "No results for “$query”",
88
+ body = "Try a different term or clear filters.",
89
+ action = "Clear search" to { viewModel.onQueryChange("") },
90
+ )
91
+ else -> LazyColumn {
92
+ items(results, key = { it.id }) { result ->
93
+ ResultRow(result = result, highlight = query)
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ Debounce belongs in the ViewModel (`debounce(250)` on the query flow), not in the composable.
102
+
103
+ ## Typed navigation with valid back behavior
104
+
105
+ ```kotlin
106
+ sealed interface Destination {
107
+ @Serializable data object Feed : Destination
108
+ @Serializable data class Detail(val id: String) : Destination
109
+ }
110
+
111
+ @Composable
112
+ fun AppNav(navController: NavHostController) {
113
+ NavHost(navController, startDestination = Destination.Feed) {
114
+ composable<Destination.Feed> {
115
+ FeedScreen(onOpen = { id -> navController.navigate(Destination.Detail(id)) })
116
+ }
117
+ composable<Destination.Detail> { backStackEntry ->
118
+ val detail: Destination.Detail = backStackEntry.toRoute()
119
+ DetailScreen(
120
+ id = detail.id,
121
+ onBack = { navController.popBackStack() },
122
+ )
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ Rules demonstrated: a detail route always has a parent in the stack, back pops to it, and deep links reconstruct the same stack.
129
+
130
+ ## Anti-patterns
131
+
132
+ - `Column` with all rows built eagerly.
133
+ - `items` without stable keys.
134
+ - Spinner replacing the whole list on refresh.
135
+ - Empty screen for zero search results.
136
+ - Dialog used as a detail destination.
137
+ - Deep link landing on detail with no parent stack.
138
+
139
+ ## Related
140
+
141
+ - `knowledge/android/lists-and-data-heavy.md`
142
+ - `knowledge/android/search-and-discovery.md`
143
+ - `skills/navigation-architect/SKILL.md`