https://kotlinlang.org logo
Title
g

gowthamkumar7

03/11/2018, 8:53 AM
How can i add transformation using picasso ? Picasso.with(this.getContext()) .load(url) .centerCrop() .fit() .transform(??--what comes here--??) .into(this)
:stackoverflow: 8
c

clubfan

03/11/2018, 10:05 AM
I haven't used it yet, but it looks like it expects a class implementing the Transformation interface. Due to SAM, one should be able to use a lambda too
Since
transform(source : Bitmap)
only takes a single parameter, you can omit that and use
it
so it's
.transform {/* do stuff with 'it' */}.into(this)
g

gowthamkumar7

03/11/2018, 12:01 PM
It is works something like this:
val circle = CircleTransformation(); Picasso.with(this.getContext()) .load(R.drawable.display_pic_gtm) .centerCrop() .fit() .transform(circle) .into(this) My bad i don't know how to create an object .
c

clubfan

03/11/2018, 12:16 PM
there's also
.transform( object() : Transformation {
     /* here goes the code */
}
)
g

gowthamkumar7

03/11/2018, 1:36 PM
yes, it takes list of transformations