Skip to content

feat: Added avatar generation in bitmap logic#746

Merged
aymericmariaux merged 4 commits intomainfrom
add-avatartypeExt-to-coil
Apr 27, 2026
Merged

feat: Added avatar generation in bitmap logic#746
aymericmariaux merged 4 commits intomainfrom
add-avatartypeExt-to-coil

Conversation

@amariaux
Copy link
Copy Markdown

Created AvatarTypeExt to handle the AvatarType processing logic and the URL to bitmap generation logic.
Refactored generateInitialsAvatarDrawable to retrieve the generated bitmap before converting it into a Drawable.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

PR Reviewer Guide 🔍

(Review updated until commit fff84c4)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect Argument Type

colors.containerColor.toArgb() returns a color value (@ColorInt), but the getBackgroundColorGradientDrawable parameter name backgroundColorRes suggests it expects a resource ID (@ColorRes). Passing a color value where a resource ID is expected will likely cause a Resources.NotFoundException or resolve to an incorrect color.

background = getBackgroundColorGradientDrawable(backgroundColorRes = colors.containerColor.toArgb()),
Inconsistent Bitmap Sizes

loadAsBitmap creates bitmaps at a hardcoded 256px, while generateWithInitials (via generateInitialsAvatarBitmap) defaults to 350px. When WithInitials.Url falls back to initials generation, the resulting bitmap will be a different size than the URL-loaded version, potentially causing UI scaling inconsistencies.

val size = 256

Comment thread Coil/src/main/java/com/infomaniak/core/coil/AvatarTypeExt.kt
Comment thread Coil/src/main/java/com/infomaniak/core/coil/AvatarTypeExt.kt
Comment thread Coil/src/main/java/com/infomaniak/core/coil/CoilXmllExt.kt Outdated
Comment thread Coil/src/main/java/com/infomaniak/core/coil/CoilXmllExt.kt Outdated
@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit fff84c4

Comment thread Coil/src/main/java/com/infomaniak/core/coil/AvatarTypeExt.kt
Copy link
Copy Markdown
Contributor

@benjaminVadon benjaminVadon left a comment

Choose a reason for hiding this comment

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

One last minor change

Comment thread Coil/src/main/java/com/infomaniak/core/coil/CoilXmllExt.kt Outdated
@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@aymericmariaux aymericmariaux force-pushed the add-avatartypeExt-to-coil branch from d53f5a6 to d8d707a Compare April 23, 2026 14:04
@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@aymericmariaux aymericmariaux force-pushed the add-avatartypeExt-to-coil branch from d8d707a to d1f46fa Compare April 27, 2026 12:19
@sonarqubecloud
Copy link
Copy Markdown

@aymericmariaux aymericmariaux merged commit aad23a1 into main Apr 27, 2026
7 checks passed
@aymericmariaux aymericmariaux deleted the add-avatartypeExt-to-coil branch April 27, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants