Skip to content

Instantly share code, notes, and snippets.

@muthuraj57
Created November 17, 2016 17:57
Show Gist options
  • Save muthuraj57/063a52534277cad75511896fe51b7395 to your computer and use it in GitHub Desktop.
Save muthuraj57/063a52534277cad75511896fe51b7395 to your computer and use it in GitHub Desktop.
if(circleTheme){
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.circle);
placeholder.setBackground(drawable);
} else {
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.square);
placeholder.setBackground(drawable);
}
placeholder.setText(getInitials());
ViewUtil.setVisibility(avatar, View.GONE);
ViewUtil.setVisibility(squareAvatar, View.GONE);
Glide.with(context)
.load(member.getAvatar())
.asBitmap()
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
if(circleTheme){
avatar.setImageBitmap(resource);
ViewUtil.setVisibility(avatar, View.VISIBLE);
} else {
squareAvatar.setImageBitmap(resource);
ViewUtil.setVisibility(squareAvatar, View.VISIBLE);
}
ViewUtil.setVisibility(placeholder, View.GONE);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment