Merged
Conversation
…e's a summary of what was created:
## Summary
### Files Created
1. **`src/adapters/output/android-xml/converters.ts`** - Utility functions for:
- `colorToAndroid()` - Converts colors to Android ARGB format (#AARRGGBB)
- `dimensionToAndroid()` - Converts dimensions to dp/sp units
- `tokenNameToAndroid()` - Converts token paths to valid Android resource names (snake_case)
- `typographyToAndroidAttrs()` - Converts typography to Android TextAppearance attributes
- XML utilities for escaping and formatting
2. **`src/adapters/output/android-xml/adapter.ts`** - Main `AndroidXmlAdapter` class:
- Implements `OutputAdapter<AndroidXmlOutput>` interface
- Generates `colors.xml`, `dimens.xml`, and `styles.xml`
- Supports night mode (dark theme) generation
- Material 3 compatible TextAppearance styles
3. **`src/adapters/output/android-xml/index.ts`** - Public exports
4. **`tests/e2e/android-xml-output.spec.ts`** - 21 test cases covering all functionality
### Files Modified
- **`src/adapters/output/index.ts`** - Added Android XML adapter exports
- **`src/index.ts`** - Added `figmaToAndroidXml()` and `generateAndroidXmlOutput()` convenience functions
### Output Format
The adapter generates standard Android resource XML compatible with Android 13-15 (API 33-35):
```xml
<!-- colors.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="color_primary">#FF3880F6</color>
</resources>
<!-- dimens.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="spacing_sm">8dp</dimen>
<dimen name="font_size_body">16sp</dimen>
</resources>
<!-- styles.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TextAppearance.BodyLarge" parent="TextAppearance.Material3.BodyMedium">
<item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif</item>
</style>
</resources>
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: Output
Effort: Small
Priority: Backlog
Android resource XML format output. Consider only currently supported Android OS versions. Provide proper patters for feature detection when needed using documentation and code sources for interfaces and schemas.