mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-19 09:21:54 +00:00
icon, contact list and conversation redesign
This commit is contained in:
@@ -3,6 +3,11 @@ package org.thoughtcrime.securesms.util;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -98,5 +103,23 @@ public class BitmapUtil {
|
||||
return options;
|
||||
}
|
||||
|
||||
public static Bitmap getCroppedBitmap(Bitmap bitmap) {
|
||||
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
|
||||
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
|
||||
final int color = 0xff424242;
|
||||
final Paint paint = new Paint();
|
||||
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
canvas.drawARGB(0, 0, 0, 0);
|
||||
paint.setColor(color);
|
||||
canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
|
||||
bitmap.getWidth() / 2, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
canvas.drawBitmap(bitmap, rect, rect, paint);
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user