Coil v0.10.0 Release Notes
Release Date: 2020-04-20 // about 4 years ago-
Highlights
๐ This version deprecates most of the DSL API in favour of using the builders directly. Here's what the change looks like:
// 0.9.5 (old) val imageLoader = ImageLoader(context) { bitmapPoolPercentage(0.5) crossfade(true) } val disposable = imageLoader.load(context, "https://www.example.com/image.jpg") { target(imageView) } val drawable = imageLoader.get("https://www.example.com/image.jpg") { size(512, 512) } // 0.10.0 (new) val imageLoader = ImageLoader.Builder(context) .bitmapPoolPercentage(0.5) .crossfade(true) .build() val request = LoadRequest.Builder(context) .data("https://www.example.com/image.jpg") .target(imageView) .build() val disposable = imageLoader.execute(request) val request = GetRequest.Builder(context) .data("https://www.example.com/image.jpg") .size(512, 512) .build() val drawable = imageLoader.execute(request).drawable
- If you're using the
io.coil-kt:coil
artifact, you can callCoil.execute(request)
to execute the request with the singletonImageLoader
.
- If you're using the
ImageLoader
s now have a weak reference memory cache that tracks weak references to images once they're evicted from the strong reference memory cache.- This means an image will always be returned from an
ImageLoader
's memory cache if there's still a strong reference to it. - Generally, this should make the memory cache much more predictable and increase its hit rate.
- This behaviour can be enabled/disabled with
ImageLoaderBuilder.trackWeakReferences
.
- This means an image will always be returned from an
Add a new artifact,
io.coil-kt:coil-video
, to decode specific frames from a video file. Read more here.โ Add a new EventListener API for tracking metrics.
โ Add ImageLoaderFactory which can be implemented by your
Application
to simplify singleton initialization.
๐ Full Release Notes
- Important: Deprecate DSL syntax in favour of builder syntax. (#267)
- Important: Deprecate
Coil
andImageLoader
extension functions. (#322) - ๐ฅ Breaking: Return sealed
RequestResult
type fromImageLoader.execute(GetRequest)
. (#349) - ๐ฅ Breaking: Rename
ExperimentalCoil
toExperimentalCoilApi
. Migrate from@Experimental
to@RequiresOptIn
. (#306) - ๐ฅ Breaking: Replace
CoilLogger
withLogger
interface. (#316) - ๐ฅ Breaking: Rename destWidth/destHeight to dstWidth/dstHeight. (#275)
- ๐ฅ Breaking: Re-arrange
MovieDrawable
's constructor params. (#272) - ๐ฅ Breaking:
Request.Listener
's methods now receive the fullRequest
object instead of just its data. - ๐ฅ Breaking:
GetRequestBuilder
now requires aContext
in its constructor. - ๐ฅ Breaking: Several properties on
Request
are now nullable. - Behaviour change: Include parameter values in the cache key by default. (#319)
- Behaviour change: Slightly adjust
Request.Listener.onStart()
timing to be called immediately afterTarget.onStart()
. (#348)
- ๐ New: Add
WeakMemoryCache
implementation. (#295) - ๐ New: Add
coil-video
to support decoding video frames. (#122) - ๐ New: Introduce
EventListener
. (#314) - ๐ New: Introduce
ImageLoaderFactory
. (#311) - ๐ New: Support animated HEIF image sequences on Android 11. (#297)
- ๐ New: Improve Java compatibility. (#262)
- ๐ New: Support setting a default
CachePolicy
. (#307) - ๐ New: Support setting a default
Bitmap.Config
. (#342) - ๐ New: Add
ImageLoader.invalidate(key)
to clear a single memory cache item (#55) - ๐ New: Add debug logs to explain why a cached image is not reused. (#346)
- ๐ New: Support
error
andfallback
drawables for get requests.
- ๐ Fix: Fix memory cache miss when Transformation reduces input bitmap's size. (#357)
- ๐ Fix: Ensure radius is below RenderScript max in BlurTransformation. (#291)
- ๐ Fix: Fix decoding high colour depth images. (#358)
- ๐ Fix: Disable
ImageDecoderDecoder
crash work-around on Android 11 and above. (#298) - ๐ Fix: Fix failing to read EXIF data on pre-API 23. (#331)
- ๐ Fix: Fix incompatibility with Android R SDK. (#337)
- ๐ Fix: Only enable inexact size if
ImageView
has a matchingSizeResolver
. (#344) - ๐ Fix: Allow cached images to be at most one pixel off requested size. (#360)
- ๐ Fix: Skip crossfade transition if view is not visible. (#361)
- ๐ Deprecate
CoilContentProvider
. (#293) - Annotate several
ImageLoader
methods with@MainThread
. - Avoid creating a
LifecycleCoroutineDispatcher
if the lifecycle is currently started. (#356) - ๐ฆ Use full package name for
OriginalSize.toString()
. - Preallocate when decoding software bitmap. (#354)
- โก๏ธ Update Kotlin to 1.3.72.
- โก๏ธ Update Coroutines to 1.3.5.
- โก๏ธ Update OkHttp to 3.12.10.
- โก๏ธ Update Okio to 2.5.0.
- โก๏ธ Update AndroidX dependencies:
androidx.exifinterface:exifinterface
-> 1.2.0