Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / keyboard / AGENTS.md
| 1 | # AGENTS.md — keyboard/ (':keyboard') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `keyboard/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install keyboard (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :keyboard / dir: keyboard/ |
| 8 | - Package roots present: ui, platform |
| 9 | - Entry files: MainActivity.kt (settings/setup UI) + ime/KeyboardService.kt (the actual IME entry) |
| 10 | - Deps: (none — zero network permission by design) |
| 11 | - Metadata: metadata_data/keyboard.md (present) |
| 12 | - Rust: no / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Private offline keyboard (IME) with Material You — no network permission at all, so keystrokes cannot leave the device. |
| 16 | **Key features:** |
| 17 | - Full IME (`KeyboardService`) with letters/symbols/function rows, key popups, adjustable height, suggestion strip |
| 18 | - CJK + Indic composition: Han (Pinyin), Kana, Hangul, Ethiopic composers over `TextBeforeCursor` |
| 19 | - Emoji pages + search, clipboard strip/page, voice-input strip (gated by a permission activity) |
| 20 | **Architecture / data-flow:** System binds `ime/KeyboardService` → `ime/KeyboardState` + `Composer` routespre-edit composition → `ui/` rows/pages render keys; `util/` holds layouts (Latin/Cyrillic/Other), dictionaries (incl. Pinyin), prefs, clipboard store. `MainActivity` is only the setup/settings UI, not the keyboard. |
| 21 | **Entry points + reading order:** `ime/KeyboardService.kt` → `ime/KeyboardState.kt` → `ime/Composer.kt` → `ui/KeyboardScreen.kt` → `util/KeyboardLayouts*.kt`. |
| 22 | **Gotchas:** |
| 23 | - `ime/` and `util/` are NOT closed package roots — pending migration; don't add more files there |
| 24 | - No-network is a guarantee, not an accident — never add a network dep or permission here |
| 25 | - Voice input needs its own permission activity before the strip works |
| 26 | |
| 27 | ## Key files |
| 28 | ### ime/ — service, state, composers (the real entry) |
| 29 | - com/vayunmathur/keyboard/ime/KeyboardService.kt — IME entry |
| 30 | - com/vayunmathur/keyboard/ime/KeyboardState.kt |
| 31 | - com/vayunmathur/keyboard/ime/Composer.kt |
| 32 | - com/vayunmathur/keyboard/ime/HanComposer.kt |
| 33 | - com/vayunmathur/keyboard/ime/KanaComposers.kt |
| 34 | - com/vayunmathur/keyboard/ime/HangulComposer.kt |
| 35 | - com/vayunmathur/keyboard/ime/EthiopicComposer.kt |
| 36 | - com/vayunmathur/keyboard/ime/TextBeforeCursor.kt |
| 37 | ### platform/ — voice input |
| 38 | - com/vayunmathur/keyboard/platform/VoiceInput.kt |
| 39 | - com/vayunmathur/keyboard/platform/VoicePermissionActivity.kt |
| 40 | ### ui/ — rows, pages, setup |
| 41 | - com/vayunmathur/keyboard/MainActivity.kt — setup/settings only |
| 42 | - com/vayunmathur/keyboard/ui/KeyboardScreen.kt |
| 43 | - com/vayunmathur/keyboard/ui/KeyboardLetters.kt |
| 44 | - com/vayunmathur/keyboard/ui/KeyboardSymbolPages.kt |
| 45 | - com/vayunmathur/keyboard/ui/KeyboardBottomRow.kt |
| 46 | - com/vayunmathur/keyboard/ui/FunctionKeys.kt |
| 47 | - com/vayunmathur/keyboard/ui/KeyButton.kt |
| 48 | - com/vayunmathur/keyboard/ui/KeyPopups.kt |
| 49 | - com/vayunmathur/keyboard/ui/SuggestionStrip.kt |
| 50 | - com/vayunmathur/keyboard/ui/EmojiPage.kt |
| 51 | - com/vayunmathur/keyboard/ui/EmojiSearch.kt |
| 52 | - com/vayunmathur/keyboard/ui/ClipboardPage.kt |
| 53 | - com/vayunmathur/keyboard/ui/ClipboardStrip.kt |
| 54 | - com/vayunmathur/keyboard/ui/VoiceStrip.kt |
| 55 | - com/vayunmathur/keyboard/ui/SetupScreen.kt |
| 56 | ### util/ — layouts, dictionaries, prefs (pending migration to closed roots) |
| 57 | - com/vayunmathur/keyboard/util/KeyboardLayout.kt |
| 58 | - com/vayunmathur/keyboard/util/KeyboardLayouts.kt |
| 59 | - com/vayunmathur/keyboard/util/KeyboardLayoutsLatin.kt |
| 60 | - com/vayunmathur/keyboard/util/KeyboardLayoutsCyrillic.kt |
| 61 | - com/vayunmathur/keyboard/util/KeyboardLayoutsOther.kt |
| 62 | - com/vayunmathur/keyboard/util/Layouts.kt |
| 63 | - com/vayunmathur/keyboard/util/Dictionary.kt |
| 64 | - com/vayunmathur/keyboard/util/PinyinDictionary.kt |
| 65 | - com/vayunmathur/keyboard/util/Emojis.kt |
| 66 | - com/vayunmathur/keyboard/util/Clipboard.kt |
| 67 | - com/vayunmathur/keyboard/util/KeyboardPrefs.kt |
| 68 | |
| 69 | ## Verify (this module only) |
| 70 | ``` |
| 71 | ./gradlew :keyboard:compileDevKotlin |
| 72 | ./gradlew :keyboard:lint |
| 73 | ./gradlew :keyboard:checkMetadata |
| 74 | ``` |