Please explain to me about this. I have 2 avatars, but only one working with Gilde library.
I follow this code (https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L26
But my application like this: http://www.mediafire.com/view/7ffhw4h1c40e4mx/Capture.PNG
. Please check image in the link.
@trinhvanminh2009 most likely you set the wrong url and glide can't load it.
As an alternative. If you chnage a profile's url you have to notify the drawer that the profile changed
@mikepenz Not wrong URL, because I load succeeded one avatar like upon image. I do not change profile's URL. I just load only one time. What I have to do now? Please check image in the link you'll more clear. Thanks.
When and where and how do you create the DrawerImageLoader?
What's the code in it?
How do you set profile?
When do you set the profile's image?
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder, String tag) {
super.set(imageView, uri, placeholder, tag);
Glide.with(imageView.getContext()).load(uri).into(imageView);
}
@Override
public void cancel(ImageView imageView) {
super.cancel(imageView);
}
});
Because This version doesn't support placeholder but I saw it's working with one image.
CurrentUser currentUser = realm.where(CurrentUser.class).findFirst();
new DrawerBuilder().withActivity(this).build();
PrimaryDrawerItem item1 = new PrimaryDrawerItem().withIdentifier(1).withName(R.string.list_order_shipper);
PrimaryDrawerItem item2 = new PrimaryDrawerItem().withIdentifier(2).withName(R.string.list_order_saved_shipper);
PrimaryDrawerItem item3 = new PrimaryDrawerItem().withIdentifier(3).withName(R.string.pay_coin_shipper);
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withIdentifier(4).withName(R.string.buy_package_shipper);
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withIdentifier(5).withName(R.string.tutorials);
PrimaryDrawerItem item6 = new PrimaryDrawerItem().withIdentifier(6).withName(R.string.profile);
PrimaryDrawerItem item7 = new PrimaryDrawerItem().withIdentifier(7).withName(R.string.about_us);
PrimaryDrawerItem item8 = new PrimaryDrawerItem().withIdentifier(8).withName(R.string.version);
PrimaryDrawerItem item9 = new PrimaryDrawerItem().withIdentifier(9).withName(R.string.setting);
PrimaryDrawerItem item10 = new PrimaryDrawerItem().withIdentifier(10).withName(R.string.log_out);
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.drawable.image_drawer)
.addProfiles(
new ProfileDrawerItem().withName(currentUser.getName())
.withEmail(currentUser.getEmail()).withIcon(currentUser.getAvatar()))
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
return false;
}
})
.build();
Sorry. I put the code in code but it's not working
@trinhvanminh2009 could you please implement glide with the DrawerImageLoader as shown here: https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L40
Sorry, But my Glide version doesn't support .placehoder. How can I fix that?
Glide not support clear and not support placehoder !!
@trinhvanminh2009 it does but you have to use the generated API:
http://bumptech.github.io/glide/doc/placeholders.html
and it also supports clear
http://bumptech.github.io/glide/doc/targets.html
Thanks. I have a problem with Glide library. I'll ask them because I changed version but it's still not working. Not support (placehoder, error). Thanks
You can use v3.8 which is used in almost every app :D v4 is not yet stable
anyways
Mike Penz
Mike Penz
Android | Backend | Open Source | Web Developer
mikepenz.com
lanora.eu
On Mon, Jul 17, 2017 at 1:56 PM, Trịnh Văn Minh notifications@github.com
wrote:
Thanks. I have a problem with Glide library. I'll ask them because I
changed version but it's still not working. Not support (placehoder,
error). Thanks—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mikepenz/MaterialDrawer/issues/1953#issuecomment-315735179,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABaGiNahkBhEOWIIDP8x8-Usf7N-1QTIks5sO0vqgaJpZM4OZhrG
.
okay. I'll do that right now. Thanks for supported.
I think I get placeholder success but it's still not working. Version 4.0 change Glide by GlideApp
This is my code. Please help.
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder, String tag) {
super.set(imageView, uri, placeholder, tag);
GlideApp.with(context).load(uri).placeholder(placeholder).error(new ColorDrawable(Color.RED)).into(imageView);
}
@Override
public void cancel(ImageView imageView) {
super.cancel(imageView);
}
@Override
public Drawable placeholder(Context ctx, String tag) {
//define different placeholders for different imageView targets
//default tags are accessible via the DrawerImageLoader.Tags
//custom ones can be checked via string. see the CustomUrlBasePrimaryDrawerItem LINE 111
if (DrawerImageLoader.Tags.PROFILE.name().equals(tag)) {
return DrawerUIUtils.getPlaceHolder(ctx);
} else if (DrawerImageLoader.Tags.ACCOUNT_HEADER.name().equals(tag)) {
return new IconicsDrawable(ctx).iconText(" ").backgroundColorRes(com.mikepenz.materialdrawer.R.color.primary).sizeDp(56);
} else if ("customUrlItem".equals(tag)) {
return new IconicsDrawable(ctx).iconText(" ").backgroundColorRes(R.color.md_red_500).sizeDp(56);
}
//we use the default one for
//DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name()
return super.placeholder(ctx, tag);
}
});
@trinhvanminh2009 I still see that the clear is not inside the cancel that's very important
Yes, I need to change the version to get attribute clear right now! I want to use version 4.0 but it's not working.
As mentioned their docs state there is a clear:
http://bumptech.github.io/glide/doc/targets.html
I don't think Glide has the problem anymore. This code also not working.
` //Download for set icon in header drawer
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder, String tag) {
super.set(imageView, uri, placeholder, tag);
Glide.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView);
}
@Override
public void cancel(ImageView imageView) {
super.cancel(imageView);
Glide.clear(imageView);
}
@Override
public Drawable placeholder(Context ctx, String tag) {
//define different placeholders for different imageView targets
//default tags are accessible via the DrawerImageLoader.Tags
//custom ones can be checked via string. see the CustomUrlBasePrimaryDrawerItem LINE 111
if (DrawerImageLoader.Tags.PROFILE.name().equals(tag)) {
return DrawerUIUtils.getPlaceHolder(ctx);
} else if (DrawerImageLoader.Tags.ACCOUNT_HEADER.name().equals(tag)) {
return new IconicsDrawable(ctx).iconText(" ").backgroundColorRes(com.mikepenz.materialdrawer.R.color.primary).sizeDp(56);
} else if ("customUrlItem".equals(tag)) {
return new IconicsDrawable(ctx).iconText(" ").backgroundColorRes(R.color.md_red_500).sizeDp(56);
}
//we use the default one for
//DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name()
return super.placeholder(ctx, tag);
}
});
`
I don't know why. I change Glide version is 3.8.0
Help me fix that. The issue not by Glide library.
I can get the image from the server into image view, How I can set image view in layout to header drawer? Thanks
@trinhvanminh2009 glide 3.x is definitely working. you can see and try it in the sample
Glide 3.x or 4.x also not working. I'm sure about this. I copy your code and paste it also not working.
where is the DrawerImageLoader defined? Is it definitely called BEFORE the drawer?
Do you have network permission?
in onCreate() ! Yes, I have. I load maps and load database from Firebase database.
Well I have no idea. Can you please provide a demo app reproducing the issue, as you are the only one who has the problem. It's working for everyone else, including a few applications of myself
Yeah ! I know. I don't know what's going on with my app. Why I can load the image from the server into the email, but can't load the image to header drawer. I'm moving on another app to work. But I'm still waiting you can fix this problem.
@trinhvanminh2009 as mentioned please provide the android app source code of a sample or something where this is reproducible. Without that I can't solve anything. Because the issue is not in the library. It's in the application code.
This is full source code: https://github.com/trinhvanminh2009/FindTheShipper
And the problem in this file: https://github.com/trinhvanminh2009/FindTheShipper/blob/master/app/src/main/java/com/minh/findtheshipper/FragmentContainerShipper.java
I was trying Glide version 3.x but it's still not working.
If you need to try version 3.x. I'll do that right now!
I make sure link to get the image from Facebook is working perfectly.
I have no idea. I downloaded your repo (adjusted a ton of things to get it compiling with the latest tooling, as a side node. you really should also use the support libraries 25.4.0 (or exclude the version from within my libraries))
And it will instantly load an image I define via url.
I had to work around the currentUser because I do not have one :D
You just login with Facebook and then my app automation create CurrentUser into Realm Database and post it to the server. I think version 25.4.0 or 25.3.1 it doesn't matter. I'll update it later. If you have free time, you can use Teamviewer to help me? Thank you so much.
@trinhvanminh2009 replace the image you load with a static url you know which should work.
If it works then, you know that the image urls you use are wrong
I tried static your link http://www.qygjxz.com/data/out/179/5054311-picture.png. But it still not working.
fascinating. It instantly showed up for me as profile picture. no problem.
Yeah! The url working, But it not working on the Emulator. Did you try that and it works on phone or Emulator?
It working like this
http://www.mediafire.com/view/7ffhw4h1c40e4mx/Capture.PNG
The code with Placeholder
https://github.com/trinhvanminh2009/FindTheShipper/blob/master/app/src/main/java/com/minh/findtheshipper/FragmentContainerShipper.java
Not working!
I never work on emulators. Because it has to work on a phone :D
And it worked on my phone with the exact source I zipped for you
Emulator or the phone also not working. I need help!
even though it worked for me. Try to move the DraewrImageLoader above the time where you init the drawer
Wowwwwwwwwwwwwwwwwwwwwww ! It working. Actually, my code has problem. I download image after I load header navigation. I'm wrong. Thank you so much. I feeling happy. haha
Awesome :)
Congratulations
Most helpful comment
Awesome :)
Congratulations