Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve icon assets naming and access for Android #72

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Feb 9, 2024

Changes:

  • Export Android icons with the ic_compound_ prefix instead of just ic_. This should avoid name collisions in Android, which could lead to the wrong icon being displayed if 2 icons have the same name.
  • Improve CompoundIcons.kt and its associated template so it's easier to measure by coverage tools. We were having issues were a large part of this file was measured as not covered by tests while the whole contents of the file were used in tests.
  • Generated new icon assets for Android.

- Add updated icon token references to `CompoundIcons.kt`.
- Make the code easier to measure by code coverage tools.
@@ -35,7 +35,7 @@ export default {

// Snake case and replace `icon` with `ic` as this is the convention on Android
// and on Material
const imageId = _.snakeCase(token.name.replace("icon", "ic"));
const imageId = _.snakeCase(token.name.replace("icon", "ic_compound_"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ic_cpd_ would be a bit nicer to use? cpd is the namespace prefix that we're using for Web, though if you find ic_compound_ clearer that's completely valid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ic_compound_ is easier to understand for newcomers than ic_cpd_, and it's not that much longer. Thanks for the suggestion though!

@jmartinesp jmartinesp merged commit 8994ca0 into main Feb 9, 2024
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