change icon size

This commit is contained in:
Daniel Gultsch 2018-04-04 09:33:31 +02:00
parent 044ea5c5a9
commit c86bc08c23

View file

@ -112,14 +112,16 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
private void drawIcon(Canvas canvas, Paint paint) { private void drawIcon(Canvas canvas, Paint paint) {
BitmapFactory.Options opts = new BitmapFactory.Options(); BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 3; opts.inSampleSize = 2;
Resources resources = mXmppConnectionService.getResources(); Resources resources = mXmppConnectionService.getResources();
Bitmap icon = BitmapFactory.decodeResource(resources, R.drawable.ic_launcher, opts); Bitmap icon = BitmapFactory.decodeResource(resources, R.drawable.ic_launcher, opts);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
int left = canvas.getWidth() - icon.getWidth(); int iconSize = Math.round(canvas.getHeight() / 2.6f);
int top = canvas.getHeight() - icon.getHeight();
final Rect rect = new Rect(left, top, left + icon.getWidth(), top + icon.getHeight()); int left = canvas.getWidth() - iconSize;
int top = canvas.getHeight() - iconSize;
final Rect rect = new Rect(left, top, left + iconSize, top + iconSize);
canvas.drawBitmap(icon, null, rect, paint); canvas.drawBitmap(icon, null, rect, paint);
} }