mikepenz/Android-Iconics

Icons not showing in androidx.appcompat.widget.Toolbar on Android 9

sschueller opened this issue · 4 comments

About this issue

I am using the following code to populate icons in item elements in the androidx.appcompat.widget.Toolbar and it works on android 10 but not on android 9. On Android 9 the icons are not drawn and there is no errors in the log.

menu.findItem(R.id.action_account).setIcon(
    new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));

I recently updated from an old version of Iconics to 5 and made the changes mentioned in the migration guide.

Did I miss something?

In the README.md there is still a statement about using IconicsDrawable(this, "faw-adjust").actionBar() but actionBar() results in an syntax error since 5 so I am confused why that in there.

Full code is here: https://github.com/sschueller/peertube-android/blob/develop/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java#L131
https://github.com/sschueller/peertube-android/blob/develop/app/src/main/res/menu/menu_top_videolist.xml
https://github.com/sschueller/peertube-android/blob/develop/app/src/main/res/layout/activity_video_list.xml#L16

Thanks

Details

Checklist

zTrap commented

actionBar() is still available in 5 version but as kotlin extension. Iconics now is kotlin-first and doesn't provide new features for Java users. Last actual version for java you can find in README

@sschueller please consider to use the latest version only in a kotlin environment. (on that note you should really start using it, you will never want to go back after falling in love with Kotlin)

That being said. the actionBar() function itself only consists of specifying size and padding:

size = IconicsSize.TOOLBAR_ICON_SIZE
padding = IconicsSize.TOOLBAR_ICON_PADDING

Hope this resolves your question :)

Thanks, I was going to convert to Kotlin eventually just haven't had the time :)

Just FYI, this issue was resolved by using Kotlin and making the call like this:

menu.findItem(id.action_account).icon = IconicsDrawable(this, faw_user_circle).actionBar()