Skip to content

Instantly share code, notes, and snippets.

@mberberoglu
Last active August 29, 2015 13:57
Show Gist options
  • Save mberberoglu/9510613 to your computer and use it in GitHub Desktop.
Save mberberoglu/9510613 to your computer and use it in GitHub Desktop.
Picasso Android
Picasso.with(context).load("http://mustafab.net/images/captain.png").into(imageView);
//Resim kesme işlemi
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView);
//Custom resim manipilasyonu
Picasso.with(context)
.load(url)
.transform(new Transformation() {
@Override
public Bitmap transform(Bitmap bitmap) {
int size = Math.min(bitmap.getWidth(), bitmap.getHeight());
int x = (bitmap.getWidth() - size) / 2;
int y = (bitmap.getHeight() - size) / 2;
Bitmap result = Bitmap.createBitmap(bitmap, x, y, size, size);
if (result != bitmap) {
bitmap.recycle();
}
return result;
}
@Override
public String key() {
return null;
}
})
.into(imageView);
//Öntanımlı view atama ve hata durumlari için view atama
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment