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 call Coil.execute(request) to execute the request with the singleton ImageLoader.
    • ImageLoaders 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.
    • 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 and ImageLoader extension functions. (#322)
    • ๐Ÿ’ฅ Breaking: Return sealed RequestResult type from ImageLoader.execute(GetRequest). (#349)
    • ๐Ÿ’ฅ Breaking: Rename ExperimentalCoil to ExperimentalCoilApi. Migrate from @Experimental to @RequiresOptIn. (#306)
    • ๐Ÿ’ฅ Breaking: Replace CoilLogger with Logger 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 full Request object instead of just its data.
    • ๐Ÿ’ฅ Breaking: GetRequestBuilder now requires a Context 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 after Target.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 and fallback 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 matching SizeResolver. (#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