diff --git a/CHANGELOG.md b/CHANGELOG.md index a82bb3dc3c..0d1c74e657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,118 @@ # Changelog +## [0.10.0] - April 20, 2020 + +### Highlights + +- **This version deprecates most of the DSL API in favour of using the builders directly.** Here's what the change looks like: + + ```kotlin + // 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`. + +- **`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`. + +- Add a new artifact, **`io.coil-kt:coil-video`**, to decode specific frames from a video file. [Read more here](https://coil-kt.github.io/coil/videos/). + +- Add a new [EventListener](https://github.com/coil-kt/coil/blob/master/coil-base/src/main/java/coil/EventListener.kt) API for tracking metrics. + +- Add [ImageLoaderFactory](https://github.com/coil-kt/coil/blob/master/coil-default/src/main/java/coil/ImageLoaderFactory.kt) which can be implemented by your `Application` to simplify singleton initialization. + +--- + +### Full Release Notes + +- **Important**: Deprecate DSL syntax in favour of builder syntax. ([#267](https://github.com/coil-kt/coil/pull/267)) +- **Important**: Deprecate `Coil` and `ImageLoader` extension functions. ([#322](https://github.com/coil-kt/coil/pull/322)) +- **Breaking**: Return sealed `RequestResult` type from `ImageLoader.execute(GetRequest)`. ([#349](https://github.com/coil-kt/coil/pull/349)) +- **Breaking**: Rename `ExperimentalCoil` to `ExperimentalCoilApi`. Migrate from `@Experimental` to `@RequiresOptIn`. ([#306](https://github.com/coil-kt/coil/pull/306)) +- **Breaking**: Replace `CoilLogger` with `Logger` interface. ([#316](https://github.com/coil-kt/coil/pull/316)) +- **Breaking**: Rename destWidth/destHeight to dstWidth/dstHeight. ([#275](https://github.com/coil-kt/coil/pull/275)) +- **Breaking**: Re-arrange `MovieDrawable`'s constructor params. ([#272](https://github.com/coil-kt/coil/pull/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](https://github.com/coil-kt/coil/pull/319)) +- **Behaviour change**: Slightly adjust `Request.Listener.onStart()` timing to be called immediately after `Target.onStart()`. ([#348](https://github.com/coil-kt/coil/pull/348)) + +--- + +- **New**: Add `WeakMemoryCache` implementation. ([#295](https://github.com/coil-kt/coil/pull/295)) +- **New**: Add `coil-video` to support decoding video frames. ([#122](https://github.com/coil-kt/coil/pull/122)) +- **New**: Introduce [`EventListener`](https://github.com/coil-kt/coil/blob/master/coil-base/src/main/java/coil/EventListener.kt). ([#314](https://github.com/coil-kt/coil/pull/314)) +- **New**: Introduce [`ImageLoaderFactory`](https://github.com/coil-kt/coil/blob/master/coil-default/src/main/java/coil/ImageLoaderFactory.kt). ([#311](https://github.com/coil-kt/coil/pull/311)) +- **New**: Support animated HEIF image sequences on Android 11. ([#297](https://github.com/coil-kt/coil/pull/297)) +- **New**: Improve Java compatibility. ([#262](https://github.com/coil-kt/coil/pull/262)) +- **New**: Support setting a default `CachePolicy`. ([#307](https://github.com/coil-kt/coil/pull/307)) +- **New**: Support setting a default `Bitmap.Config`. ([#342](https://github.com/coil-kt/coil/pull/342)) +- **New**: Add `ImageLoader.invalidate(key)` to clear a single memory cache item ([#55](https://github.com/coil-kt/coil/pull/55)) +- **New**: Add debug logs to explain why a cached image is not reused. ([#346](https://github.com/coil-kt/coil/pull/346)) +- **New**: Support `error` and `fallback` drawables for get requests. + +--- + +- Fix: Fix memory cache miss when Transformation reduces input bitmap's size. ([#357](https://github.com/coil-kt/coil/pull/357)) +- Fix: Ensure radius is below RenderScript max in BlurTransformation. ([#291](https://github.com/coil-kt/coil/pull/291)) +- Fix: Fix decoding high colour depth images. ([#358](https://github.com/coil-kt/coil/pull/358)) +- Fix: Disable `ImageDecoderDecoder` crash work-around on Android 11 and above. ([#298](https://github.com/coil-kt/coil/pull/298)) +- Fix: Fix failing to read EXIF data on pre-API 23. ([#331](https://github.com/coil-kt/coil/pull/331)) +- Fix: Fix incompatibility with Android R SDK. ([#337](https://github.com/coil-kt/coil/pull/337)) +- Fix: Only enable inexact size if `ImageView` has a matching `SizeResolver`. ([#344](https://github.com/coil-kt/coil/pull/344)) +- Fix: Allow cached images to be at most one pixel off requested size. ([#360](https://github.com/coil-kt/coil/pull/360)) +- Fix: Skip crossfade transition if view is not visible. ([#361](https://github.com/coil-kt/coil/pull/361)) + +--- + +- Deprecate `CoilContentProvider`. ([#293](https://github.com/coil-kt/coil/pull/293)) +- Annotate several `ImageLoader` methods with `@MainThread`. +- Avoid creating a `LifecycleCoroutineDispatcher` if the lifecycle is currently started. ([#356](https://github.com/coil-kt/coil/pull/356)) +- Use full package name for `OriginalSize.toString()`. +- Preallocate when decoding software bitmap. ([#354](https://github.com/coil-kt/coil/pull/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 + ## [0.9.5] - February 6, 2020 - Fix: Ensure a view is attached before checking if it is hardware accelerated. This fixes a case where requesting a hardware bitmap could miss the memory cache. diff --git a/README-ko.md b/README-ko.md index 3421392412..fa7c437b6d 100644 --- a/README-ko.md +++ b/README-ko.md @@ -16,7 +16,7 @@ Coil은: **Co**routine **I**mage **L**oader의 약자입니다. Coil은 `mavenCentral()`로 이용 가능합니다. ```kotlin -implementation("io.coil-kt:coil:0.9.5") +implementation("io.coil-kt:coil:0.10.0") ``` ## 빠른 시작 @@ -46,12 +46,6 @@ imageView.load("https://www.example.com/image.jpg") { } ``` -이미지를 직접적으로 가져오기 위해서, `get` [suspend](https://kotlinlang.org/docs/reference/coroutines/basics.html) function을 사용합니다: - -```kotlin -val drawable = Coil.get("https://www.example.com/image.jpg") -``` - [여기서 Coil의 전체 문서](https://coil-kt.github.io/coil/)를 확인하세요. ## 요구사항 diff --git a/README.md b/README.md index f82ddcd1c0..43f4b9826c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Made with ❤️ at [Instacart](https://www.instacart.com). Translations: [한 Coil is available on `mavenCentral()`. ```kotlin -implementation("io.coil-kt:coil:0.9.5") +implementation("io.coil-kt:coil:0.10.0") ``` ## Quick Start @@ -46,15 +46,30 @@ imageView.load("https://www.example.com/image.jpg") { } ``` -To get an image imperatively, use the `get` [suspend](https://kotlinlang.org/docs/reference/coroutines/basics.html) function: +To load an image into a custom target, execute a `LoadRequest`: ```kotlin -val drawable = Coil.get("https://www.example.com/image.jpg") +val request = LoadRequest.Builder(context) + .data("https://www.example.com/image.jpg") + .target { drawable -> + // Handle the result. + } + .build() +Coil.execute(request) ``` -Coil requires Java 8 bytecode. [Here's how to enable it](https://coil-kt.github.io/coil/getting_started/#java-8). +To get an image imperatively, execute a `GetRequest`: -Check out Coil's [full documentation here](https://coil-kt.github.io/coil/). +```kotlin +val request = GetRequest.Builder(context) + .data("https://www.example.com/image.jpg") + .build() +val drawable = Coil.execute(request).drawable +``` + +The above examples use `io.coil-kt:coil`, which contains the `Coil` singleton. Optionally, you can depend on `io.coil-kt:coil-base` instead and inject your own [`ImageLoader`](https://coil-kt.github.io/coil/image_loaders/) instance(s). + +Coil requires [Java 8 bytecode](https://coil-kt.github.io/coil/getting_started/#java-8). Check out Coil's [full documentation here](https://coil-kt.github.io/coil/). ## Requirements diff --git a/coil-gif/README.md b/coil-gif/README.md index a01d4cc28d..01ee4e32c6 100644 --- a/coil-gif/README.md +++ b/coil-gif/README.md @@ -5,7 +5,7 @@ Unlike Glide, GIFs are not supported by default. However, Coil has an extension To add GIF support, import the extension library: ```kotlin -implementation("io.coil-kt:coil-gif:0.9.5") +implementation("io.coil-kt:coil-gif:0.10.0") ``` And add the decoders to your component registry when constructing your `ImageLoader`: diff --git a/coil-svg/README.md b/coil-svg/README.md index f66931eee0..c37ec591cd 100644 --- a/coil-svg/README.md +++ b/coil-svg/README.md @@ -3,7 +3,7 @@ To add SVG support, import the extension library: ```kotlin -implementation("io.coil-kt:coil-svg:0.9.5") +implementation("io.coil-kt:coil-svg:0.10.0") ``` And add the decoder to your component registry when constructing your `ImageLoader`: diff --git a/coil-video/README.md b/coil-video/README.md index 12d29ab244..b7e7251055 100644 --- a/coil-video/README.md +++ b/coil-video/README.md @@ -3,7 +3,7 @@ To add video frame support, import the extension library: ```kotlin -implementation("io.coil-kt:coil-video:0.10.0-SNAPSHOT") +implementation("io.coil-kt:coil-video:0.10.0") ``` And add the two fetchers to your component registry when constructing your `ImageLoader`: diff --git a/gradle.properties b/gradle.properties index 588d1356ce..3d0852417b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ compileSdk=29 # Maven GROUP=io.coil-kt -VERSION_NAME=0.10.0-SNAPSHOT +VERSION_NAME=0.10.0 POM_DESCRIPTION=An image loading library for Android backed by Kotlin Coroutines. POM_INCEPTION_YEAR=2019