How rkkr/simple-keyboard works
Project Type & Purpose
• Native Android Input Method (IME) app (Simple Keyboard)
• Purpose: lightweight, customizable on-screen keyboard without extra permissions or ads
File Structure
• app/src/main/java/rkr/simplekeyboard/inputmethod
– Core IME service classes (LatinIME extends InputMethodService)
– Compatibility helpers for different Android versions
• app/src/main/java/rkr/simplekeyboard/inputmethod/keyboard
– UI classes: KeyboardView, MainKeyboardView, MoreKeysPanel
– Keyboard model: Key, KeyboardLayoutSet, KeyboardTheme, KeyboardState
• app/src/main/java/rkr/simplekeyboard/inputmethod/event
– Event dispatcher & transaction (touch → key detection)
• app/src/main/java/rkr/simplekeyboard/inputmethod/latin
– Input logic: InputLogic, RichInputConnection, AudioAndHapticFeedbackManager
– Settings fragments & manager for themes, languages, preferences
• app/src/main/res
– XML layouts, keyboard definitions, themes, localizations
Key Insights from README
• Built on AOSP LatinIME
• No network calls, no external dependencies (ads, emoji, spell-checker)
• Minimal permissions: Vibrate only
Main Components
a. Android System (IME framework & Services)
b. IME Service Layer
– LatinIME (extends InputMethodService)
– SystemBroadcastReceiver (e.g., language change)
c. UI Layer
– KeyboardView / MainKeyboardView / MoreKeysKeyboardView
– Preview & drawing helpers (KeyPreviewView, DrawingProxy)
d. Input & Event Pipeline
– Touch events → Event.java → InputTransaction → KeyDetector → MoreKeysDetector
– ProximityInfo, PointerTracker, BogusMoveEventDetector
e. Business Logic Layer
– InputLogic (character composition, pointer moves, delete swipe)
– AudioAndHapticFeedbackManager
f. Configuration & Resource Layer
– PreferenceManagerCompat / SettingsActivity & fragments
g. Android Services & APIs
– VibratorService, AudioManager, InputConnection API
Relationships & Data Flow
1. User Touch → Android OS → InputMethodService.onTouchEvent
2. onTouchEvent → Event dispatcher → InputTransaction
3. InputTransaction → KeyDetector → identify Key → send to KeyboardActionListener
4. KeyboardActionListener → InputLogic processes (e.g., character vs delete)
5. InputLogic → RichInputConnection.commitText or sendKeyEvent → Host application
6. InputLogic → AudioAndHapticFeedbackManager.vibrate/playSound
7. Settings changes (via SettingsActivity) → PreferenceManager → LatinIME reloads config
8. XML layouts & themes loaded at startup / on configuration change
Architectural Patterns & Principles
• Separation of Concerns: UI rendering vs event detection vs input logic vs configuration
• Plug-in-style resource architecture: keyboard definitions & themes in XML → parsed by KeyboardBuilder
• Compatibility Layer: isolated helpers for Android version differences
Elements
– Clear component names (Android IME Framework, LatinIME Service, KeyboardView)