Skip to content

IconicsMenuInflaterUtil: don't unset non-iconics menu item icons - #667

Merged
mikepenz merged 1 commit into
mikepenz:developfrom
PrOF-kk:menu_inflater_fix
Aug 20, 2026
Merged

IconicsMenuInflaterUtil: don't unset non-iconics menu item icons#667
mikepenz merged 1 commit into
mikepenz:developfrom
PrOF-kk:menu_inflater_fix

Conversation

@PrOF-kk

@PrOF-kk PrOF-kk commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

I've been testing the Java equivalent of this for about a week and it works fine.

2 considerations:

  • Would break if the attributes are renamed to not start with ico_ (ok since library is very stable)
  • A "cleaner" fix might be to ensure IconicsAttrsExtractor returns null if no attrs are specified, but I wanted to avoid potential behaviour changes

Fixes #666

@mikepenz mikepenz added the fix label Aug 20, 2026
@mikepenz
mikepenz merged commit 8e6483c into mikepenz:develop Aug 20, 2026
1 check passed
mikepenz added a commit that referenced this pull request Aug 20, 2026
IconicsAttrsApplier.getIconicsDrawable() always returned a drawable, even
for an AttributeSet carrying no `ico_*` attribute at all, because the
extractor falls back to creating an empty IconicsDrawable. Every caller
treats a non-null result as "there is iconics data here" and assigns it,
so a menu item's `android:icon` or an ImageView's `android:src` got
replaced by an empty drawable.

Return null when the styled attributes are empty, which is what all three
call sites (IconicsMenuInflaterUtil, and the ActionMenuItemView / ImageView
branches of IconicsFactory) already handle.

Adds regression tests over `menu_playground`, which covers an item with a
plain `android:icon`, an item defined via `ico_*` attributes and an item
with no icon at all.

Fixes #666
Supersedes #667
Co-authored-by: PrOF-kk <valerio.colella.2001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IconicsMenuInflaterUtil unsets non-iconics menu icons

2 participants