Coil v0.12.0 Release Notes
Release Date: 2020-08-18 // over 3 years ago-
- ๐ฅ Breaking:
LoadRequest
andGetRequest
have been replaced withImageRequest
:ImageLoader.execute(LoadRequest)
->ImageLoader.enqueue(ImageRequest)
ImageLoader.execute(GetRequest)
->ImageLoader.execute(ImageRequest)
ImageRequest
implementsequals
/hashCode
.
- ๐ฅ Breaking: A number of classes were renamed and/or changed package:
coil.request.RequestResult
->coil.request.ImageResult
coil.request.RequestDisposable
->coil.request.Disposable
coil.bitmappool.BitmapPool
->coil.bitmap.BitmapPool
coil.DefaultRequestOptions
->coil.request.DefaultRequestOptions
- ๐ฅ Breaking:
SparseIntArraySet
has been removed from the public API. - ๐ฅ Breaking:
TransitionTarget
no longer implementsViewTarget
. - ๐ฅ Breaking:
ImageRequest.Listener.onSuccess
's signature has changed to return anImageResult.Metadata
instead of just aDataSource
. - ๐ฅ Breaking: Remove support for
LoadRequest.aliasKeys
. This API is better handled with direct read/write access to the memory cache.
- Important: Values in the memory cache are no longer resolved synchronously (if called from the main thread).
- This change was also necessary to support executing
Interceptor
s on a background dispatcher. - This change also moves more work off the main thread, improving performance.
- This change was also necessary to support executing
- Important:
Mappers
are now executed on a background dispatcher. As a side effect, automatic bitmap sampling is no longer automatically supported. To achieve the same effect, use theMemoryCache.Key
of a previous request as theplaceholderMemoryCacheKey
of the subsequent request. See here for an example.- The
placeholderMemoryCacheKey
API offers more freedom as you can "link" two image requests with different data (e.g. different URLs for small/large images).
- The
- Important: Coil's
ImageView
extension functions have been moved from thecoil.api
package to thecoil
package.- Use find + replace to refactor
import coil.api.load
->import coil.load
. Unfortunately, it's not possible to use Kotlin'sReplaceWith
functionality to replace imports.
- Use find + replace to refactor
- Important: Use standard crossfade if drawables are not the same image.
- Important: Prefer immutable bitmaps on API 24+.
- Important:
MeasuredMapper
has been deprecated in favour of the newInterceptor
interface. See here for an example of how to convert aMeasuredMapper
into anInterceptor
.Interceptor
is a much less restrictive API that allows for a wider range of custom logic.
- Important:
ImageRequest.data
is now not null. If you create anImageRequest
without setting its data it will returnNullRequestData
as its data.
- ๐ New: Add support for direct read/write access to an
ImageLoader
'sMemoryCache
. See the docs for more information. - ๐ New: Add support for
Interceptor
s. See the docs for more information. Coil'sInterceptor
design is heavily inspired by OkHttp's! - ๐ New: Add the ability to enable/disable bitmap pooling using
ImageLoader.Builder.bitmapPoolingEnabled
.- Bitmap pooling is most effective on API 23 and below, but may still be benificial on API 24 and up (by eagerly calling
Bitmap.recycle
).
- Bitmap pooling is most effective on API 23 and below, but may still be benificial on API 24 and up (by eagerly calling
- ๐ New: Support thread interruption while decoding.
- ๐ Fix parsing multiple segments in content-type header.
- Rework bitmap reference counting to be more robust.
- ๐ Fix WebP decoding on API < 19 devices.
- ๐ฆ Expose FetchResult and DecodeResult in the EventListener API.
- Compile with SDK 30.
- โก๏ธ Update Coroutines to 1.3.8.
- โก๏ธ Update OkHttp to 3.12.12.
- โก๏ธ Update Okio to 2.7.0.
- โก๏ธ Update AndroidX dependencies:
androidx.appcompat:appcompat-resources
-> 1.2.0androidx.core:core-ktx
-> 1.3.1
- ๐ฅ Breaking: