A2UI icon indicating copy to clipboard operation
A2UI copied to clipboard

feature : renderer android jetpack

Open divyanshsaraswat opened this issue 5 hours ago • 0 comments

PR: feat(android): Implement Native A2UI Renderer & Interactive Contact Lookup Sample

Description

Implemented the initial version of the Android native renderer for the A2UI protocol and updated the sample client to verify its functionality against the contact_lookup agent.

Changes

Android Renderer (renderers/android)

  • Core Components: Implemented ReflectiveIconRenderer to dynamically load standard and extended Material Icons by name. Added DividerRenderer and ImageRenderer (using Coil).
  • Dynamic Loading: Added kotlin-reflect and material-icons-extended dependencies to support the full range of A2UI icons without hardcoding.
  • Registry: Updated ComponentRegistry to map JSON types (e.g., "Icon", "Divider") to their Compose counterparts.

Sample Application (samples/client/android)

  • Interactive UI: Refactored MainActivity to include a standard text input and send button, enabling real-time user-agent interaction.
  • Robust Networking: Fixed JSON-RPC protocol issues (previously using incorrect method names) and implemented manual JSON parsing to handle polymorphic ServerMessage types correctly.
  • Environment Fixes: Added URL rewriting (localhost -> 10.0.2.2) for emulator compatibility and increased Gradle heap size to 4GB to prevent OOM errors.
  • Documentation: Updated README.md with clear setup and running instructions.

Verification

  • ✅ Verified against the local contact_lookup agent.
  • ✅ Confirmed rendering of complex layouts (Columns, Rows, Cards), text, images, and dynamic icons.
  • ✅ Validated interactive query flow ("Find contact info...").
image image

divyanshsaraswat avatar Dec 29 '25 13:12 divyanshsaraswat