Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / keyboard / AGENTS.md

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