UI Architecture
Quick Start
- Confirm where the UI belongs:
shared/src/commonMain/...for reusable/domain UI and ViewModel logic.app/src/main/java/...for Android runtime integration (permissions, intents, activity launchers, file system APIs).
- Confirm landscape constraints before layout work (manifest + base activity).
- Follow existing routing contracts (
Screen,NavDestination,NavState) instead of introducing a parallel navigation stack. - Follow state/event/effect MVVM flow before adding mutable local state.
- Keep visual design aligned with this repo's MD3 + glass style (
RaLaunchTheme,GlassSurface, motion and state feedback patterns).
Mandatory Pre-Modification Context
Before proposing UI changes, read these files first:
app/src/main/AndroidManifest.xmlapp/src/main/java/com/app/ralaunch/core/ui/base/BaseActivity.ktapp/src/main/java/com/app/ralaunch/feature/main/MainActivityCompose.ktapp/src/main/java/com/app/ralaunch/feature/main/MainApp.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/navigation/NavRoutes.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/navigation/AppNavHost.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/navigation/NavigationExtensions.ktapp/src/main/java/com/app/ralaunch/feature/main/contracts/MainContracts.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/feature/settings/SettingsViewModel.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/component/game/GameListContent.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/theme/Theme.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/theme/Color.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/theme/Shape.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/theme/Typography.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/component/GlassComponents.ktshared/src/commonMain/kotlin/com/app/ralaunch/shared/core/component/AppNavigationRail.kt
For deeper project context, load:
../map-project-structure/references/rotatingart-architecture.mdreferences/ui-implementation-notes.md
Landscape Rules
- Keep screens landscape-first. All launcher activities are locked to
sensorLandscape; do not add portrait-only UI assumptions. - Prefer split-pane
Rowlayouts for high-information screens (list + detail). - Reuse existing layout proportions when possible (for example
0.62/0.38or0.65/0.35) before introducing new ratios. - Validate both landscape widths commonly seen on tablets and phones; avoid fixed widths that break at smaller heights.
Routing Notes (Brief)
- Routing is custom and state-driven (
NavState), not Navigation ComposeNavController. - Add new routes to
Screenfirst (NavRoutes.kt). - If the screen is a primary rail tab, add/update
NavDestinationtoo. - Render route content in
MainApppage routing (PageContent) and wire Android-specific dependencies inMainActivityComposewrapper slots. - Keep back behavior consistent with
handleBackPress():- Pop sub-screen stack first.
- If on a non-games root destination, return to games before exiting.
MVVM Notes (Brief)
- Prefer unidirectional data flow:
UiStateasStateFlowUiEventinput to ViewModelUiEffectfor one-time side effects
- Keep domain/business logic in repository/use-case layers, not Composables.
- Keep Android integration in app wrappers:
- activity result launchers
- permission flows
- intents/toasts/navigation side effects
- Use shared ViewModels for cross-platform reusable features; use app ViewModels for Android-only orchestration.
- Avoid new legacy MVP-style code for new UI work; align with existing Compose + ViewModel paths.
MD3 Design Rules
- Always render feature UI under
RaLaunchTheme; do not create parallel theming systems. - Prefer semantic tokens over hard-coded values:
- color:
MaterialTheme.colorScheme.*andRaLaunchTheme.extendedColors - type:
MaterialTheme.typography.* - shape:
MaterialTheme.shapes.*/AppShapes
- color:
- Use MD3 surface layering for hierarchy (
surfaceContainerLow->surfaceContainerHighest) instead of arbitrary alpha overlays. - Reuse existing glass primitives for blurred panels (
GlassSurface,GlassSurfaceRegular) rather than custom blur stacks. - Keep state communication explicit:
- selected, pressed, disabled, focused states must be visually distinct
- actions should use MD3 components (
Button,AssistChip,DropdownMenu, etc.) before custom controls
- Maintain consistency with current motion language:
- short transitions for feedback (
150-300ms) - medium transitions for page/surface changes (
250-450ms) - spring for press/select responses when needed
- short transitions for feedback (
- Keep one dominant accent per screen; avoid mixing unrelated highlight colors that reduce visual hierarchy.
Good UI Quality Bar
- Build for task clarity:
- one primary action per pane
- keep secondary actions grouped and visually quieter
- Build for scanability in landscape:
- split-pane composition for dense workflows
- avoid long single-column forms when side-by-side grouping is possible
- Build for resilient states:
- loading, empty, and error states must exist for each data-driven screen
- destructive actions require clear confirmation
- Build for usability:
- touch targets should remain comfortable in landscape (
~48dpminimum) - long labels should degrade gracefully (ellipsis/wrapping rules)
- touch targets should remain comfortable in landscape (
- Build for accessibility:
- meaningful
contentDescriptionfor icons/images - sufficient contrast for text and controls over video/image backgrounds
- meaningful
- Build for performance:
- keep expensive operations out of Composables
- use stable keys in lazy lists/grids
- avoid heavy recomposition loops in animated screens
Workflow
- Identify target screen type:
- Main tab (
NavDestination) - Sub-screen (
Screenwith back stack) - Dialog/overlay in current screen
- Main tab (
- Reuse existing composables/components before creating new ones (
AppNavigationRail,GameListContent, settings/file-browser shared UI). - Add/extend
UiState,UiEvent,UiEffectcontracts before wiring UI interactions. - Apply MD3 token decisions (color/type/shape/surface hierarchy) before finalizing visuals.
- Keep platform-specific code in app wrappers and shared logic in
sharedmodule. - Validate behavior:
- route transitions
- back behavior
- state restoration after resume/config changes
- landscape usability
- interaction feedback (pressed/selected/disabled/loading/error)
- contrast/readability on themed backgrounds
Output Contract
When using this skill for implementation guidance, provide:
- Target files and module boundaries (
appvsshared). - Routing impact (
Screen/NavDestination/PageContentchanges). - MVVM contract impact (
UiState/UiEvent/UiEffect+ ViewModel updates). - Landscape layout impact (pane structure, width ratios, overflow handling).
- MD3 design decisions (tokens/components/motion/surface layering).
- UI quality checks (state coverage, usability, accessibility, performance).
- Test/validation checklist (manual + automated where practical).