Skip to content

feat: comprehensive improvements — new resource types, API enhancements, code quality#15

Merged
Jawnnypoo merged 1 commit into
mainfrom
feat/comprehensive-improvements
Jun 9, 2026
Merged

feat: comprehensive improvements — new resource types, API enhancements, code quality#15
Jawnnypoo merged 1 commit into
mainfrom
feat/comprehensive-improvements

Conversation

@VeldtJumper

@VeldtJumper VeldtJumper commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Comprehensive improvements to ResourcesPoet covering new resource types, API enhancements, and code quality fixes.

New Resource Types

  • fraction<fraction name="width">50%p</fraction> for percentage values
  • int-quantity<int-quantity name="count"> with quantity variants (zero, one, two, few, many, other)
  • int-quantity-array — array of integer quantity resources
  • color-array<color-array name="colors"> for arrays of color references
  • bool-array<bool-array name="flags"> for arrays of boolean values
  • reference<item type="reference" name="x">@drawable/y</item> for resource references

API Improvements

  • addColor(name, Int) — Int overload for integer color values (e.g., R.color.primary)
  • buildBytes() — Returns XML as ByteArray for in-memory processing
  • create(file, indent, elementType) — Load font-family XML files via ELEMENT.FONT_FAMILIES
  • translatable on arrays — addStringArray and addTypedArray now support translatable = false
  • format on styles — addStyle now accepts a format attribute parameter
  • FontFamilyRes — New data class for font-family with integer resource references

Code Quality

  • Replaced manual format string concatenation with joinToString
  • Removed stale "Does this mess up ordering?" comments
  • Expanded add(type, name, value) to support FRACTION, COLOR_ARRAY, BOOL_ARRAY
  • Updated add(type) doc to reflect expanded support

New Files

  • Quantity.kt — int-quantity data class
  • Reference.kt — @reference data class with toValue() helper
  • FontFamilyRes.kt — font-family with integer resource ID

Tests

13 new test files covering all new features. 73 total tests passing.

README

Updated with examples for all new features.

…ts, code quality

New resource types:
- fraction (addFraction)
- int-quantity / int-quantity-array (addIntQuantity, addIntQuantityArray)
- color-array (addColorArray)
- bool-array (addBoolArray)
- reference (addReference with Reference data class)

API improvements:
- addColor(name, Int) overload for integer color values
- buildBytes() for ByteArray output
- create(file, indent, elementType) for font-family files
- translatable attribute on addStringArray and addTypedArray
- format attribute on addStyle
- FontFamilyRes data class with addFontFamilyRes method

Code quality:
- Replace manual format string concatenation with joinToString
- Remove stale 'Does this mess up ordering?' comments
- Expand add(type, name, value) to support FRACTION, COLOR_ARRAY, BOOL_ARRAY
- Update add(type) doc to reflect expanded support

Tests: 13 new test files, 73 total tests passing
README: Updated with all new features and examples
Jawnnypoo added a commit that referenced this pull request Jun 9, 2026
…-cleaned

feat: resource additions & API improvements (cleaned up from #15)
@Jawnnypoo Jawnnypoo merged commit 1f38386 into main Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants