How omar-haidar/androidide works
Project type and purpose
• AndroidIDE is a fully offline Android application (an IDE) comprising:
– A user-facing Android app (UI, editor, designer, terminal emulator).
– Numerous reusable libraries (common, shared, sdk-info, xml-inflater, treeview, emulatorview, lexers).
– In-app language-server clients (LSP modules: api, java, xml) talking over JSON-RPC.
– Build tools and services (GradleBuildService, tooling-api modules, eventbus, jsonrpc).
• Purpose: provide code editing, project creation, build/Gradle support, LSP-driven code intelligence, and an integrated terminal on Android.
File structure & architectural patterns
• Top-level modules:
– /app: Android app module (Activities, Fragments, Views, ViewModels).
– /common, /shared: core utility & model libraries.
– /emulatorview, /xml-inflater, /treeview, /lexers, /sdk-info: specialized feature libraries.
– /actions: plugin-style registry of editor/build actions.
– /lsp (api, java, xml, models, testing): LSP client stacks.
– /build-tools, /gradle-plugin: bundled CLI libs (eventbus, jsonrpc, tooling-api, google-formatter, javac-services, etc.).
• Architectural patterns:
– Modular monorepo with clear separation of UI, domain services, tooling services, and language tooling.
– MVVM in /app (Activities→ViewModels→Services).
– EventBus for in-app event dispatch (publish–subscribe).
– JSON-RPC channels for LSP and build tooling.
– ShellServer abstraction wrapping Termux/Busybox for executing external binaries.
Readme insights
• Lists key features: Gradle, terminal, SDK manager, LSP, UI designer, Git (terminal only).
• Indicates under-development modules (partial LSP/Kotlin, UI Designer).
• Confirms use of GPLv3 and embedded third-party editors (Rosemoe), terminal (Termux), tree view, Java LSP server.
a. Components
1. AndroidIDE App (UI Layer)
– Activities/Fragments/ViewModels/Adapters/Views (code editor, designer UI, file/terminal UI).
2. Common/Shared Libraries
– Utilities: File I/O, JSON, logging, preferences, eventbus, progress management.
3. Actions Registry
– Plugin architecture for build/editor actions (build, run, lint, copy/paste, find, etc.).
4. Shell & Build Service
– ShellServer (Termux-backed); GradleBuildService; ToolingApiServer; eventbus & jsonrpc modules.
5. Language-Server Clients
– LSP API layer; Java LSP client; XML LSP client. Communicates via JSON-RPC.
6. External Binaries & SDK Data
– Bundled aapt2, busybox, gradle-wrapper, tooling-api jars, android.jar, SDK metadata (sdk-info).
7. UI Feature Libraries
– emulatorview (terminal emulator), xml-inflater (layout preview), treeview, lexers.
b. Relationships & interactions
1. UI Layer → ViewModels → Services
– E.g., EditorActivityActionMenu triggers a build action.
2. BuildAction → GradleBuildService → ToolingApiServerImpl → Tooling API modules → Gradle Daemon (local process).
3. EditorCompletion → LSP API → JSONRpc (lsp/api, jsonrpc) → JavaLanguageServer / XMLLanguageServer (in-app service).
4. TerminalActivity → ShellServer → JNI/Busybox binaries.
6. Common & Shared libs support cross-cutting (% logging, preferences, file search, progress).
c. Key patterns & principles
• Layered modular architecture: clear UI/domain/tooling separation.
• Plugin architecture for actions (ActionsRegistry).
• MVVM for UI; EventBus for decoupled messaging.
• JSON-RPC for language/build server communication.
• Shell abstraction for invoking native binaries on Android.
d. Technologies & frameworks
• Android SDK (API≥26)
• Gradle multi-module
• Kotlin & Java
• Rosemoe’s Sora code editor widget
• GreenRobot EventBus
• LSP4J / custom JSON-RPC
• Termux & Busybox binaries
Essential elements
• Action path is traceable end-to-end (e.g., “RunActionMenu → GradleBuildService → Gradle Daemon → Build Artifacts”).
• JSON-RPC channels between App and LSP or Tooling API.
• Don’t over-crowd: group related feature libs (emulatorview, xml-inflater, treeview, lexers) under “UI Feature Libraries.”