i am trying to load my account header background and header item icon as url but it doesn't work instead it will keep placeholders.
code
private void setUpDrawer() {
//initialize and create the image loader logic
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder) {
Glide.with(imageView.getContext())
.load(uri)
.apply(new RequestOptions().placeholder(placeholder))
.into(imageView);
}
@Override
public void cancel(ImageView imageView) {
Glide.with(imageView.getContext()).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(R.color.primaryColor).sizeDp(56);
} else if ("customUrlItem".equals(tag)) {
return new IconicsDrawable(ctx).iconText(" ").backgroundColorRes(R.color.colorAccent).sizeDp(56);
}
//we use the default one for
//DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name()
return super.placeholder(ctx, tag);
}
/*
@Override
public Drawable placeholder(Context ctx) {
return super.placeholder(ctx);
}
*/
});
// Create the AccountHeader
headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(new ImageHolder(header_img_url))
.addProfiles(
new ProfileDrawerItem()
.withName("Zulqurnain Haider")
.withEmail("zulqurnainjutt@gmail.com")
.withIcon(my_profile_pic_url)
)
.withOnAccountHeaderListener((view, profile, currentProfile) -> false)
.build();
//if you want to update the items at a later time it is recommended to keep it in a variable
PrimaryDrawerItem item1 =
new PrimaryDrawerItem()
.withIdentifier(1)
.withName("Something 1");
SecondaryDrawerItem item2 =
new SecondaryDrawerItem()
.withIdentifier(2)
.withName("Something 2");
//create the drawer and remember the `Drawer` result object
drawerResult = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withAccountHeader(headerResult)
.addDrawerItems(
item1,
new DividerDrawerItem(),
item2,
new SecondaryDrawerItem().withName("Settings")
)
.withOnDrawerItemClickListener((view, position, drawerItem) -> {
// do something with the clicked item :D
ToastUtils.showShort("item" + drawerItem.toString());
return true;
})
.build();
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
drawerResult.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
}
Details
[ 6.0.6 ] Used library version
[ 27.1.0 ] Used support library version
[ 3.0.1 ] Used gradle build tools version
[ Android Studio ] Used tooling / Android Studio version
[ None ] Other used libraries, potential conflicting libraries
i am trying to load my account header background and header item icon as url but it doesn't work instead it will keep placeholders.
code
Details
[ 6.0.6 ] Used library version
[ 27.1.0 ] Used support library version
[ 3.0.1 ] Used gradle build tools version
[ Android Studio ] Used tooling / Android Studio version
[ None ] Other used libraries, potential conflicting libraries
[ #1940 #720 ] Searched for similar issues -https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L18 (tried that didn't worked)