This library is no longer maintained, use coil-kt instead.
Kotlin extensions for Picasso image loader.
- Invoke callback and target with Kotlin DSL.
- Use pre-loaded transformations with extension functions.
- Supports material components Palette alongside too.
dependencies {
compile "com.hendraanggrian.appcompat:picasso-ktx:$version"
}
Snapshots of the development version are available in Sonatype's snapshots repository.
Call picasso
to get global instance of Picasso
.
Or buildPicasso
to invoke Picasso.Builder
.
picasso.load(url).into(imageView)
val myPicasso = buildPicasso {
loggingEnabled(true)
memoryCache(Cache.NONE)
listener { picasso, uri, exception -> }
}
myPicasso.load(url).into(imageView)
Clean declaration of Callback
when loading images into ImageView
.
picasso.load(url).into(imageView) {
onSuccess {
celebrate()
}
}
Or into Target
with Kotlin DSL.
picasso.load(url).into {
onLoaded { bitmap, from ->
process(bitmap)
}
}
Transform request using Kotlin extension functions.
picasso.load(url)
.circle()
.into(imageView)
// multiple transformations are also supported
picasso.load(url)
.circle()
.grayscale()
.into(imageView)
Transformations | |
---|---|
crop square | square() |
crop circle | circle() |
crop rounded | rounded(radius) rounded(radius, margin)<br> rounded(radius, margin, usedDp) |
overlay | overlay(color, alpha) overlay(context, colorRes, alpha) |
grayscale | grayscale() |