Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void setCircleImageViews() {
- Picasso.with(getApplicationContext()).load(Uri.parse(UserData.getMatchTrioPicsUrls().get(0))).transform(new CropCircleTransformation()).into(commonFriendProfile);
- Picasso.with(getApplicationContext()).load(Uri.parse(UserData.getMatchTrioPicsUrls().get(1))).transform(new CropCircleTransformation()).into(leftFriendProfile);
- Picasso.with(getApplicationContext()).load(Uri.parse(UserData.getMatchTrioPicsUrls().get(2))).transform(new CropCircleTransformation()).into(rightFriendProfile);
- }
- @Override public Bitmap transform(Bitmap source) {
- int size = Math.min(source.getWidth(), source.getHeight());
- int width = (source.getWidth() - size) / 2;
- int height = (source.getHeight() - size) / 2;
- Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- Paint paint = new Paint();
- BitmapShader shader =
- new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
- if (width != 0 || height != 0) {
- // source isn't square, move viewport to center
- Matrix matrix = new Matrix();
- matrix.setTranslate(-width, -height);
- shader.setLocalMatrix(matrix);
- }
- paint.setShader(shader);
- paint.setAntiAlias(true);
- float r = size / 2f;
- canvas.drawCircle(r, r, r, paint);
- source.recycle();
- return bitmap;
- Called getConfig() on a recycle()'d bitmap! This is undefined behavior!
Add Comment
Please, Sign In to add comment