DrawerImageLoader not running set function
wakaztahir opened this issue · 5 comments
About this issue
- I initialized the DrawerImageLoader like this
- DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) {
Log.d("RUNNINGDDDDDD","III")
Glide.with(context).load(account?.photoUrl).placeholder(placeholder).into(imageView)
}
})
I placed a Log call inside the set function and it just does't call , I have a profile item like this
addProfiles(
ProfileDrawerItem().apply {
nameText = accountName
descriptionText = accountEmail
badgeStyle = BadgeStyle().apply {
textColor = ColorHolder.fromColor(Color.BLACK)
color = ColorHolder.fromColorRes(R.color.primaryColor)
}
},
ProfileSettingDrawerItem().apply {
name = StringHolder("Manage Account")
description = StringHolder("Manage Timeline Account")
icon = ImageHolder(
IconicsDrawable(
context,
CommunityMaterial.Icon.cmd_account_cog_outline
)
)
identifier = 100001
}
)
Details
- [ 8.3.3] Used library version
- [No] Used support library version
- [no idea] Used gradle build tools version
- [4.2 beta 6] Used tooling / Android Studio version
- [no other] Other used libraries, potential conflicting libraries
Checklist
- [yes] Searched for similar issues
- [yes] Checked out the sample application
- [yes] Read the README
- [yes] Checked out the CHANGELOG
- [yes] Read the FAQ
- [no] Checked out the MIGRATION GUIDE
I have also put the loader in the onCreate function before the content view is even set but that did't work , Glide is loading the image fine in other places but the set function is just not being called.
I would also like to know , how to have multiple items selected in the drawer
Thanks in advance
Also when I opened the project in android studio , It gave a content prolog error , I wanted to see the sample app code but I think the issue is that I don't see a xml root tag in the xml files of the app
content is not allowed in prolog
@wakaztahir the imageloader should be set in the application to ensure it happened before the drawer is used. beyond that. your sample does not look like setting a url
as icon. it will only call the loader when it is needed (e.g. when you specify the url drawable to the item)
Thanks , as soon as I specified a url , it started working but the image is still displaying squared !
Do you have any idea how to make it circular and make it fit , Otherwise thanks for help
@wakaztahir usually image loaders provide APIs which allow you to transform the image to the needed form. e.g. ciruclar.
Beyond this. the ProfileDrawerItem
uses a BezelImageView
and applies the style as defined in the theme
https://github.com/mikepenz/MaterialDrawer/blob/develop/materialdrawer/src/main/res/layout/material_drawer_item_profile.xml#L16
Thanks I used
Glide.with(context).load(account?.photoUrl).placeholder(placeholder).circleCrop().into(imageView)
which did it !