A2UI
A2UI copied to clipboard
feature : renderer android jetpack
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
ReflectiveIconRendererto dynamically load standard and extended Material Icons by name. AddedDividerRendererandImageRenderer(using Coil). - Dynamic Loading: Added
kotlin-reflectandmaterial-icons-extendeddependencies to support the full range of A2UI icons without hardcoding. - Registry: Updated
ComponentRegistryto map JSON types (e.g., "Icon", "Divider") to their Compose counterparts.
Sample Application (samples/client/android)
- Interactive UI: Refactored
MainActivityto 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
ServerMessagetypes 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.mdwith clear setup and running instructions.
Verification
- ✅ Verified against the local
contact_lookupagent. - ✅ Confirmed rendering of complex layouts (Columns, Rows, Cards), text, images, and dynamic icons.
- ✅ Validated interactive query flow ("Find contact info...").