Coil v0.12.0 Release Notes

Release Date: 2020-08-18 // over 3 years ago
    • ๐Ÿ’ฅ Breaking: LoadRequest and GetRequest have been replaced with ImageRequest:
      • ImageLoader.execute(LoadRequest) -> ImageLoader.enqueue(ImageRequest)
      • ImageLoader.execute(GetRequest) -> ImageLoader.execute(ImageRequest)
      • ImageRequest implements equals/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 implements ViewTarget.
    • ๐Ÿ’ฅ Breaking: ImageRequest.Listener.onSuccess's signature has changed to return an ImageResult.Metadata instead of just a DataSource.
    • ๐Ÿ’ฅ 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 Interceptors on a background dispatcher.
      • This change also moves more work off the main thread, improving performance.
    • 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 the MemoryCache.Key of a previous request as the placeholderMemoryCacheKey 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).
    • Important: Coil's ImageView extension functions have been moved from the coil.api package to the coil package.
      • Use find + replace to refactor import coil.api.load -> import coil.load. Unfortunately, it's not possible to use Kotlin's ReplaceWith functionality to replace imports.
    • 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 new Interceptor interface. See here for an example of how to convert a MeasuredMapper into an Interceptor.
      • 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 an ImageRequest without setting its data it will return NullRequestData as its data.

    • ๐Ÿ†• New: Add support for direct read/write access to an ImageLoader's MemoryCache. See the docs for more information.
    • ๐Ÿ†• New: Add support for Interceptors. See the docs for more information. Coil's Interceptor 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).
    • ๐Ÿ†• 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.0
      • androidx.core:core-ktx -> 1.3.1