use of com.owncloud.android.ui.StatusDrawable in project android by nextcloud.
the class BitmapUtils method createAvatarWithStatus.
public static Bitmap createAvatarWithStatus(Bitmap avatar, StatusType statusType, String icon, Context context) {
float avatarRadius = getResources().getDimension(R.dimen.list_item_avatar_icon_radius);
int width = DisplayUtils.convertDpToPixel(2 * avatarRadius, context);
Bitmap output = Bitmap.createBitmap(width, width, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
// avatar
Bitmap croppedBitmap = getCroppedBitmap(avatar, width);
canvas.drawBitmap(croppedBitmap, 0f, 0f, null);
// status
int statusSize = width / 4;
Status status = new Status(statusType, "", icon, -1);
StatusDrawable statusDrawable = new StatusDrawable(status, statusSize, context);
canvas.translate(width / 2f, width / 2f);
statusDrawable.draw(canvas);
return output;
}
Aggregations