Rounded corners for avatars

This commit is contained in:
M66B 2019-08-12 20:13:20 +02:00
parent 61415bab7c
commit 12abe6e9e5
1 changed files with 7 additions and 2 deletions

View File

@ -175,7 +175,7 @@ public class ContactInfo {
}
boolean circular = prefs.getBoolean("circular", true);
if (info.bitmap != null && circular) {
if (info.bitmap != null) {
int w = info.bitmap.getWidth();
int h = info.bitmap.getHeight();
@ -198,7 +198,12 @@ public class ContactInfo {
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(Color.GRAY);
if (circular)
canvas.drawOval(new RectF(dest), paint);
else {
float radius = Helper.dp2pixels(context, 3);
canvas.drawRoundRect(new RectF(dest), radius, radius, paint);
}
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(info.bitmap, source, dest, paint);