Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / ui / AGENTS.md
| 1 | # AGENTS.md — library/ui/ (':library:ui') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `library/ui/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | - Gradle: :library:ui / dir: library/ui/ |
| 6 | - Package roots present: ui |
| 7 | - Entry files: MaActivity.kt, AppScaffold.kt, Icons.kt + icons.tsv (no app MainActivity/Route — this is the shared shell) |
| 8 | - Deps: :library |
| 9 | - Network: none — offline-banner connectivity UI lives in `:library:network` |
| 10 | (`util/ConnectivityCompose.kt`); network apps depend on it directly |
| 11 | - Metadata: metadata_data/library-ui.md (absent — libraries have none by design) |
| 12 | - Rust: no / screenshotTest: no |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** All shared Compose chrome for every app — activity shells, scaffolds, theme, icons, messenger, editors, motion. If it renders in more than one app, it lives here. |
| 16 | **How to use (must-rules, enforced by lint):** |
| 17 | - Activities extend `MaActivity` (or `MaFragmentActivity` for biometric-gated apps) — override `Content()` + `onCreateBeforeContent()`, never repeat the edge-to-edge/theme shell |
| 18 | - Screens use the `AppScaffold` family (never raw `Scaffold`); icons via the generated `IconXxx()` wrappers (manifest `icons.tsv`, generated at build time by `GenerateIconsTask`; never `Icon()`/`painterResource()`/`material.icons.*` in apps, never hand-edit the generated file — add one manifest line and rebuild); messages via `rememberMessenger()`/`AppMessages` (never `Toast`); motion via the `Motion*` helpers (never raw `animation` at call sites) |
| 19 | **Areas:** activity shells (`MaActivity.kt`) · scaffolds (`AppScaffold`, `Detail`/`LazyList`/`TabbedPager`/`Setup`, `ListPage`) · theme + tokens (`DynamicTheme`, `Material*`, `Spacing`, `Modifier`, `Motion*`) · `Icons.kt` · messenger (`Messages.kt`) · editors (Html/Markdown/Odf + controllers) · pickers + dialogs (`dialog/`) · game chrome (`game/`) · ODF/doc export (`odf/`) · panorama · permissions + special-access · adaptive/wide layouts (`AdaptiveGrid`, `DesktopMaxWidth`, `PaneMargins`) · connectivity banner (`util/ConnectivityCompose.kt`). |
| 20 | **Entry points + reading order:** `MaActivity.kt` → `AppScaffold.kt` → `Icons.kt` → `Messages.kt` → `DynamicTheme.kt`, then the area you need. |
| 21 | **Gotchas:** |
| 22 | - One public `@Composable` per file, named as the file; closed package roots still apply inside this library |
| 23 | - Never `imePadding()`/`navigationBarsPadding()`/`systemBarsPadding()` in this library's reusable components: the shared `Scaffold` wrapper owns IME (unconditional `contentWindowInsets ∪ ime`, consumed as `navigationBars ∪ ime` for content, so a stray inset modifier under an AppScaffold-family screen is a no-op). Exceptions that still own their insets: `bottomBar`-slot bars (`EditorBottomBar`, `BottomAppBar` — outside consumed content) and non-Scaffold overlays (`HistoryScrubberCard` — nav-bars only, suppressed with justification) |
| 24 | - Connectivity UI (`OfflineAware`/`rememberIsOnline`) lives in `:library:network`, not here |
| 25 | - `MaFragmentActivity(autoSetContent=false)` + `showContent()` is the biometric-gate pattern (passwords, photos) |
| 26 | |
| 27 | ## Key files |
| 28 | ### Shell + scaffolds — start here |
| 29 | - com/vayunmathur/library/ui/MaActivity.kt — shared activity shell (incl. `MaFragmentActivity`) |
| 30 | - com/vayunmathur/library/ui/AppScaffold.kt |
| 31 | - com/vayunmathur/library/ui/DetailScaffold.kt |
| 32 | - com/vayunmathur/library/ui/LazyListScaffold.kt |
| 33 | - com/vayunmathur/library/ui/TabbedPagerScaffold.kt |
| 34 | - com/vayunmathur/library/ui/SetupScaffold.kt |
| 35 | - com/vayunmathur/library/ui/ListPage.kt |
| 36 | ### Theme + tokens |
| 37 | - com/vayunmathur/library/ui/DynamicTheme.kt |
| 38 | - com/vayunmathur/library/ui/Icons.kt — hand-written `AppIcon` + `IconNavigation` back buttons; ONLY place (with the generated wrappers) allowed `Icon()`/`painterResource()` |
| 39 | - com/vayunmathur/library/ui/icons.tsv — icon manifest, the source of truth for every generated `IconXxx()` wrapper (name, kind, Material/drawable/vector source, content description, KDoc) |
| 40 | - com/vayunmathur/library/ui/IconsCustom.kt — hand-authored `ImageVector`s (`Book2`, lane-guidance vectors, `HelpOutlineVector`) the manifest references as `vector:<name>` |
| 41 | - com/vayunmathur/library/ui/Messages.kt — messenger + `AppMessages` |
| 42 | - com/vayunmathur/library/ui/MaterialAliases.kt |
| 43 | - com/vayunmathur/library/ui/MaterialComponents.kt |
| 44 | - com/vayunmathur/library/ui/MaterialComponentsExtra.kt |
| 45 | - com/vayunmathur/library/ui/MaterialFunctions.kt |
| 46 | - com/vayunmathur/library/ui/Motion.kt — motion helpers (use these, not raw animation) |
| 47 | - com/vayunmathur/library/ui/MotionValues.kt |
| 48 | - com/vayunmathur/library/ui/Spacing.kt |
| 49 | - com/vayunmathur/library/ui/Modifier.kt |
| 50 | - com/vayunmathur/library/ui/ContentColorOn.kt |
| 51 | - com/vayunmathur/library/ui/VerticalShape.kt |
| 52 | - com/vayunmathur/library/ui/DateString.kt |
| 53 | - com/vayunmathur/library/ui/RememberClock.kt |
| 54 | ### Adaptive + wide layouts |
| 55 | - com/vayunmathur/library/ui/AdaptiveGrid.kt |
| 56 | - com/vayunmathur/library/ui/AdaptiveWindow.kt |
| 57 | - com/vayunmathur/library/ui/DesktopMaxWidth.kt |
| 58 | - com/vayunmathur/library/ui/PaneMargins.kt |
| 59 | - com/vayunmathur/library/ui/SwappedContent.kt |
| 60 | - com/vayunmathur/library/ui/SwappedTopBar.kt |
| 61 | - com/vayunmathur/library/ui/TopAppBarOverlay.kt |
| 62 | - com/vayunmathur/library/ui/SafeListItemLayout.kt |
| 63 | ### Common screens + state |
| 64 | - com/vayunmathur/library/ui/StateScreens.kt |
| 65 | - com/vayunmathur/library/ui/NoPermissionsScreen.kt |
| 66 | - com/vayunmathur/library/ui/DashboardSection.kt |
| 67 | - com/vayunmathur/library/ui/GameCenterScreen.kt |
| 68 | - com/vayunmathur/library/ui/AchievementNotification.kt |
| 69 | - com/vayunmathur/library/ui/HistoryScrubber.kt |
| 70 | - com/vayunmathur/library/ui/SelectionMode.kt |
| 71 | - com/vayunmathur/library/ui/SwipeActionsBox.kt |
| 72 | - com/vayunmathur/library/ui/CommonSearchBar.kt |
| 73 | - com/vayunmathur/library/ui/ScaffoldSearch.kt — scaffold `search` parameter value (screen-level search is declared here, never by placing CommonSearchBar in app content; fatal `ScaffoldSearch` lint) |
| 74 | - com/vayunmathur/library/ui/OverflowMenu.kt |
| 75 | - com/vayunmathur/library/ui/ConfirmDialog.kt |
| 76 | - com/vayunmathur/library/ui/SingleChoiceDialog.kt |
| 77 | - com/vayunmathur/library/ui/TextInputDialog.kt |
| 78 | - com/vayunmathur/library/ui/AddToListDialog.kt |
| 79 | - com/vayunmathur/library/ui/BannerVisibility.kt |
| 80 | - com/vayunmathur/library/ui/ExpandVisibility.kt |
| 81 | - com/vayunmathur/library/ui/FadeVisibility.kt |
| 82 | - com/vayunmathur/library/ui/PopVisibility.kt |
| 83 | - com/vayunmathur/library/ui/FreeHeightBottomSheet.kt |
| 84 | - com/vayunmathur/library/ui/FreeHeightSheetState.kt |
| 85 | ### Media viewer |
| 86 | - com/vayunmathur/library/ui/ZoomState.kt — pure zoom/pan value + anchored pinch, clamp, double-tap math |
| 87 | - com/vayunmathur/library/ui/ZoomGestures.kt — `zoomGestures()` pinch/pan/double-tap modifier, pager-friendly (photos viewer, appstore screenshots) |
| 88 | ### Forms + settings |
| 89 | - com/vayunmathur/library/ui/FormComponents.kt |
| 90 | - com/vayunmathur/library/ui/FormSection.kt |
| 91 | - com/vayunmathur/library/ui/SettingsComponents.kt |
| 92 | - com/vayunmathur/library/ui/SettingsSliderRow.kt |
| 93 | - com/vayunmathur/library/ui/SettingsRadioRow.kt |
| 94 | - com/vayunmathur/library/ui/SettingsFooter.kt |
| 95 | - com/vayunmathur/library/ui/DailyReminderSettingsSection.kt |
| 96 | - com/vayunmathur/library/ui/MultiCategoryPicker.kt |
| 97 | - com/vayunmathur/library/ui/RingtonePicker.kt |
| 98 | - com/vayunmathur/library/ui/BackupButtons.kt — shared backup destination picker buttons |
| 99 | - com/vayunmathur/library/ui/ShareVaultDialog.kt — everysync vault share dialog |
| 100 | ### Reorderable grids |
| 101 | - com/vayunmathur/library/ui/ReorderableGrid.kt |
| 102 | - com/vayunmathur/library/ui/ReorderableGridGestures.kt |
| 103 | - com/vayunmathur/library/ui/ReorderableUtil.kt |
| 104 | ### Permissions + system access |
| 105 | - com/vayunmathur/library/ui/AppPermissionsGate.kt |
| 106 | - com/vayunmathur/library/ui/PermissionRequest.kt |
| 107 | - com/vayunmathur/library/ui/PermissionRequirement.kt |
| 108 | - com/vayunmathur/library/ui/SpecialAccess.kt |
| 109 | - com/vayunmathur/library/ui/ExternalIntents.kt |
| 110 | - com/vayunmathur/library/ui/AppPullToRefreshBox.kt |
| 111 | ### Maps + sensors |
| 112 | - com/vayunmathur/library/ui/MapsPoiVectors.kt |
| 113 | - com/vayunmathur/library/ui/MapUnavailableMessage.kt |
| 114 | - com/vayunmathur/library/ui/CompassCalibrationBanner.kt |
| 115 | - com/vayunmathur/library/ui/CompassCalibrationHint.kt |
| 116 | ### Panorama |
| 117 | - com/vayunmathur/library/ui/PanoramaCameraState.kt |
| 118 | - com/vayunmathur/library/ui/PanoramaCrop.kt |
| 119 | - com/vayunmathur/library/ui/PanoramaSphere.kt |
| 120 | - com/vayunmathur/library/ui/PanoramaSphereView.kt |
| 121 | ### Editors — Html |
| 122 | - com/vayunmathur/library/ui/HtmlEditor.kt |
| 123 | - com/vayunmathur/library/ui/HtmlEditorController.kt |
| 124 | - com/vayunmathur/library/ui/HtmlEditorControllerCore.kt |
| 125 | - com/vayunmathur/library/ui/HtmlEditorSpans.kt |
| 126 | - com/vayunmathur/library/ui/HtmlSerialize.kt |
| 127 | - com/vayunmathur/library/ui/HtmlText.kt — `scrollInternally`/`fitContentToWidth` for long untrusted mail |
| 128 | - com/vayunmathur/library/ui/HtmlTextDocument.kt — pure document wrapper (viewport, CSP, fit CSS) |
| 129 | - com/vayunmathur/library/ui/RichEmailSpans.kt |
| 130 | - com/vayunmathur/library/ui/EditorFormatter.kt |
| 131 | - com/vayunmathur/library/ui/EditorLink.kt |
| 132 | ### Editors — Markdown |
| 133 | - com/vayunmathur/library/ui/MarkdownEditor.kt |
| 134 | - com/vayunmathur/library/ui/MarkdownEditOps.kt |
| 135 | - com/vayunmathur/library/ui/MarkdownToHtml.kt |
| 136 | - com/vayunmathur/library/ui/OdfMarkdownEditor.kt |
| 137 | ### dialog/ — date/time pickers |
| 138 | - com/vayunmathur/library/ui/dialog/DatePickerDialog.kt |
| 139 | - com/vayunmathur/library/ui/dialog/TimePickerDialog.kt |
| 140 | ### game/ — shared game chrome |
| 141 | - com/vayunmathur/library/ui/game/GameModeChooser.kt |
| 142 | - com/vayunmathur/library/ui/game/GameResultOverlay.kt |
| 143 | - com/vayunmathur/library/ui/game/GameTopBarActions.kt |
| 144 | - com/vayunmathur/library/ui/game/GameInfoBox.kt |
| 145 | - com/vayunmathur/library/ui/game/GameInfoBoxes.kt |
| 146 | - com/vayunmathur/library/ui/game/DailyChallengeCard.kt |
| 147 | - com/vayunmathur/library/ui/game/DailyStreakText.kt |
| 148 | - com/vayunmathur/library/ui/game/HeartsRow.kt |
| 149 | - com/vayunmathur/library/ui/game/FormatDuration.kt |
| 150 | ### odf/ — document model + exporters |
| 151 | - com/vayunmathur/library/ui/odf/OdfDocument.kt |
| 152 | - com/vayunmathur/library/ui/odf/OdfText.kt |
| 153 | - com/vayunmathur/library/ui/odf/OdfTextEditorState.kt |
| 154 | - com/vayunmathur/library/ui/odf/OdfTextEditorView.kt |
| 155 | - com/vayunmathur/library/ui/odf/OdfTextHelpers.kt |
| 156 | - com/vayunmathur/library/ui/odf/OdfParagraphOps.kt |
| 157 | - com/vayunmathur/library/ui/odf/OdfRunEdits.kt |
| 158 | - com/vayunmathur/library/ui/odf/OdfDocTransform.kt |
| 159 | - com/vayunmathur/library/ui/odf/OdfListPrefixes.kt |
| 160 | - com/vayunmathur/library/ui/odf/OdfMetadata.kt |
| 161 | - com/vayunmathur/library/ui/odf/OdfTables.kt |
| 162 | - com/vayunmathur/library/ui/odf/OdfSlides.kt |
| 163 | - com/vayunmathur/library/ui/odf/OdfSerializer.kt |
| 164 | - com/vayunmathur/library/ui/odf/HtmlOdfConverter.kt |
| 165 | - com/vayunmathur/library/ui/odf/HtmlOdfExport.kt |
| 166 | - com/vayunmathur/library/ui/odf/MarkdownOdfConverter.kt |
| 167 | - com/vayunmathur/library/ui/odf/RtfOdfConverter.kt |
| 168 | - com/vayunmathur/library/ui/odf/EpubExporter.kt |
| 169 | - com/vayunmathur/library/ui/odf/OoxmlExporter.kt |
| 170 | - com/vayunmathur/library/ui/odf/PdfExporter.kt |
| 171 | - com/vayunmathur/library/ui/odf/LatexExporter.kt |
| 172 | ### Connectivity |
| 173 | - com/vayunmathur/library/util/ConnectivityCompose.kt — offline banner (`OfflineAware`); lives in `:library:network`, not this module |
| 174 | - com/vayunmathur/library/ui/Haptics.kt |
| 175 | |
| 176 | ## Verify (this module only) |
| 177 | ``` |
| 178 | ./gradlew :library:ui:compileDevKotlin |
| 179 | ./gradlew :library:ui:lint |
| 180 | python3 scripts/check_icons_parity.py <old Icons.kt> library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt library/ui/build/generated/kotlin/generateDebugIcons/IconsGenerated.kt |
| 181 | ``` |