Skip to content

Commit

Permalink
Prepare 2.0.0-rc01. (#1006)
Browse files Browse the repository at this point in the history
* Update documentation for 2.0.

* Tweaks.

* More fixes.

* More fixes.

* Fix.

* Finish updating docs.

* Update docs.

* Tweaks.

* Update readme.

* Update readme.

* Docs.

* Remove comment.

* Docs.

* Docs.

* Tweak.

* Tweak.

* Tweak.

* Fix brackets.

* Add to changelog.

* Update requirements.

* Start migration doc.

* Move to FAQ.

* Improvements.

* Update links.

* Update changelog.

* Remove migration doc.

* Update.

* Docs.

* Update version name.

* Updates.

* Docs.

* Rearrange.

* Update date.

* Docs.

* Tweak docs.
  • Loading branch information
colinrtwhite authored Mar 3, 2022
1 parent 82bfad8 commit 7013cdf
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 418 deletions.
56 changes: 53 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Changelog

## [2.0.0-rc01] - March 2, 2022

Significant changes since `1.4.0`:

- The minimum supported API is now 21.
- Rework the Jetpack Compose integration.
- `rememberImagePainter` has been renamed to `rememberAsyncImagePainter`.
- Add support for `AsyncImage` and `SubcomposeAsyncImage`. Check out [the documentation](https://coil-kt.github.io/coil/compose/) for more info.
- Deprecate `LocalImageLoader`. Check out the deprecation message for more info.
- Coil 2.0 has its own disk cache implementation and no longer relies on OkHttp for disk caching.
- Use `ImageLoader.Builder.diskCache` and `DiskCache.Builder` to configure the disk cache.
- You **should not** use OkHttp's `Cache` with Coil 2.0 as the cache can be corrupted if a thread is interrupted while writing to it.
- `Cache-Control` and other cache headers are still supported - except `Vary` headers, as the cache only checks that the URLs match. Additionally, only responses with a response code in the range [200..300) are cached.
- Existing disk caches will be cleared when upgrading to 2.0.
- `ImageRequest`'s default `Scale` is now `Scale.FIT`
- This was changed to make `ImageRequest.scale` consistent with other classes that have a default `Scale`.
- Requests with an `ImageViewTarget` still have their `Scale` auto-detected.
- Rework the image pipeline classes:
- `Mapper`, `Fetcher`, and `Decoder` have been refactored to be more flexible.
- `Fetcher.key` has been replaced with a new `Keyer` interface. `Keyer` creates the cache key from the input data.
- Adds `ImageSource`, which allows `Decoder`s to read `File`s directly using Okio's file system API.
- Disable generating runtime not-null assertions.
- If you use Java, passing null as a not-null annotated parameter to a function will no longer throw a `NullPointerException` immediately. Kotlin's compile-time null safety guards against this happening.
- This change allows the library's size to be smaller.
- `BitmapPool` and `PoolableViewTarget` have been removed from the library.
- `VideoFrameFileFetcher` and `VideoFrameUriFetcher` are removed from the library. Use `VideoFrameDecoder` instead, which supports all data sources.
- [`BlurTransformation`](https://github.com/coil-kt/coil/blob/845f39383f332428077c666e3567b954675ce248/coil-base/src/main/java/coil/transform/BlurTransformation.kt) and [`GrayscaleTransformation`](https://github.com/coil-kt/coil/blob/845f39383f332428077c666e3567b954675ce248/coil-base/src/main/java/coil/transform/GrayscaleTransformation.kt) are removed from the library. If you use them, you can copy their code into your project.
- Change `Transition.transition` to be a non-suspending function as it's no longer needed to suspend the transition until it completes.
- Add support for `bitmapFactoryMaxParallelism`, which restricts the maximum number of in-progress `BitmapFactory` operations. This value is 4 by default, which improves UI performance.
- Add support for `interceptorDispatcher`, `fetcherDispatcher`, `decoderDispatcher`, and `transformationDispatcher`.
- Add `GenericViewTarget`, which handles common `ViewTarget` logic.
- Add `ByteBuffer` to the default supported data types.
- `Disposable` has been refactored and exposes the underlying `ImageRequest`'s job.
- Rework the `MemoryCache` API.
- `ImageRequest.error` is now set on the `Target` if `ImageRequest.fallback` is null.
- `Transformation.key` is replaced with `Transformation.cacheKey`.
- Update Kotlin to 1.6.10.
- Update Compose to 1.1.1.
- Update OkHttp to 4.9.3.
- Update Okio to 3.0.0.

Changes since `2.0.0-alpha09`:

- Remove the `-Xjvm-default=all` compiler flag.
- Fix failing to load image if multiple requests with must-revalidate/e-tag are executed concurrently.
- Fix `DecodeUtils.isSvg` returning false if there is a new line character after the `<svg` tag.
- Make `LocalImageLoader.provides` deprecation message clearer.
- Update Compose to 1.1.1.
- Update `accompanist-drawablepainter` to 0.23.1.

## [2.0.0-alpha09] - February 16, 2022

- Fix `AsyncImage` creating invalid constraints. ([#1134](https://github.com/coil-kt/coil/pull/1134))
Expand Down Expand Up @@ -58,7 +108,7 @@
- Mutate `ImageLoader` placeholder/error/fallback drawables.
- Add default arguments to `SuccessResult`'s constructor.
- Depend on `androidx.collection` instead of `androidx.collection-ktx`.
- Update Okhttp to 4.9.3.
- Update OkHttp to 4.9.3.

## [2.0.0-alpha04] - November 22, 2021

Expand Down Expand Up @@ -151,7 +201,7 @@ Coil 2.0.0 is the next major iteration of the library and has new features, perf
- **Important**: The minimum supported API is now 21.
- **Important**: Enable `-Xjvm-default=all`.
- This generates Java 8 default methods instead of using Kotlin's default interface method support. Check out [this blog post](https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/) for more information.
- **You'll need to add `-Xjvm-default=all` or `-Xjvm-default=all-compatibility` to your build file as well.** See [here](https://coil-kt.github.io/coil/getting_started/#java-8) for how to do this.
- **You'll need to add `-Xjvm-default=all` or `-Xjvm-default=all-compatibility` to your build file as well.** See [here](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8) for how to do this.
- **Important**: Coil now has its own disk cache implementation and no longer relies on OkHttp for disk caching.
- This change was made to:
- Better support thread interruption while decoding images. This improves performance when image requests are started and stopped in quick succession.
Expand Down Expand Up @@ -369,7 +419,7 @@ Changes since `1.0.0-rc3`:

- **This release requires Kotlin 1.4.0 or above.**
- Update Kotlin to 1.4.0 and enable [`-Xjvm-default=all`](https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/).
- **[See here](https://coil-kt.github.io/coil/getting_started/#java-8) for how to enable `-Xjvm-default=all` in your build file.**
- **[See here](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8) for how to enable `-Xjvm-default=all` in your build file.**
- This generates Java 8 default methods for default Kotlin interface methods.
- Remove all existing deprecated methods in 0.12.0.
- Update Coroutines to 1.3.9.
Expand Down
7 changes: 3 additions & 4 deletions README-ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Coil은: **Co**routine **I**mage **L**oader의 약자입니다.
Coil은 `mavenCentral()`로 이용 가능합니다.

```kotlin
implementation("io.coil-kt:coil:1.4.0")
implementation("io.coil-kt:coil:2.0.0-rc01")
```

## 빠른 시작
Expand Down Expand Up @@ -50,9 +50,8 @@ imageView.load("https://www.example.com/image.jpg") {

## 요구사항

- AndroidX
- Min SDK 14+
- [Java 8+](https://coil-kt.github.io/coil/getting_started/#java-8)
- Min SDK 21+
- [Java 8+](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8)

## R8 / Proguard

Expand Down
7 changes: 3 additions & 4 deletions README-tr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Coil şunların baş harflerinden oluşur: **Co**routine **I**mage **L**oader.
Coil `mavenCentral()`'da mevcuttur.

```kotlin
implementation("io.coil-kt:coil:1.4.0")
implementation("io.coil-kt:coil:2.0.0-rc01")
```

## Hızlı Başlangıç
Expand Down Expand Up @@ -90,9 +90,8 @@ Coil'in [dokümantasyonunun tamamına buradan](https://coil-kt.github.io/coil/ge

## Gereksinimler

- AndroidX
- Min SDK 14+
- [Java 8+](https://coil-kt.github.io/coil/getting_started/#java-8)
- Min SDK 21+
- [Java 8+](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8)

## R8 / Proguard

Expand Down
7 changes: 3 additions & 4 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Coil 名字的由来:取 **Co**routine **I**mage **L**oader 首字母得来。
Coil 可以在 `mavenCentral()` 下载

```kotlin
implementation("io.coil-kt:coil:1.4.0")
implementation("io.coil-kt:coil:2.0.0-rc01")
```

## 快速上手
Expand Down Expand Up @@ -85,9 +85,8 @@ val drawable = imageLoader.execute(request).drawable

## 环境要求

- AndroidX
- Min SDK 14+
- [Java 8+](https://coil-kt.github.io/coil/getting_started/#java-8)
- Min SDK 21+
- [Java 8+](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8)

## R8 / Proguard

Expand Down
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

An image loading library for Android backed by Kotlin Coroutines. Coil is:

- **Fast**: Coil performs a number of optimizations including memory and disk caching, downsampling the image in memory, re-using bitmaps, automatically pausing/cancelling requests, and more.
- **Fast**: Coil performs a number of optimizations including memory and disk caching, downsampling the image in memory, automatically pausing/cancelling requests, and more.
- **Lightweight**: Coil adds ~2000 methods to your APK (for apps that already use OkHttp and Coroutines), which is comparable to Picasso and significantly less than Glide and Fresco.
- **Easy to use**: Coil's API leverages Kotlin's language features for simplicity and minimal boilerplate.
- **Modern**: Coil is Kotlin-first and uses modern libraries including Coroutines, OkHttp, Okio, and AndroidX Lifecycles.
Expand All @@ -16,20 +16,19 @@ Made with ❤️ at [Instacart](https://www.instacart.com). Translations: [한
Coil is available on `mavenCentral()`.

```kotlin
implementation("io.coil-kt:coil:1.4.0")
implementation("io.coil-kt:coil:2.0.0-rc01")
```

## Quick Start

#### ImageViews

To load an image into an `ImageView`, use the `load` extension function:

```kotlin
// URL
imageView.load("https://www.example.com/image.jpg")

// Resource
imageView.load(R.drawable.image)

// File
imageView.load(File("/path/to/image.jpg"))

Expand All @@ -46,21 +45,40 @@ imageView.load("https://www.example.com/image.jpg") {
}
```

#### Jetpack Compose

Import the [Jetpack Compose](https://developer.android.com/jetpack/compose) extension library:

```kotlin
implementation("io.coil-kt:coil-compose:2.0.0-rc01")
```

To load an image, use the `AsyncImage` composable:

```kotlin
AsyncImage(
model = "https://example.com/image.jpg",
contentDescription = null
)
```

#### Image Loaders

`imageView.load` uses the singleton `ImageLoader` to enqueue an `ImageRequest`. The singleton `ImageLoader` can be accessed using an extension function:
Both `imageView.load` and `AsyncImage` use the singleton `ImageLoader` to execute image requests. The singleton `ImageLoader` can be accessed using a `Context` extension function:

```kotlin
val imageLoader = context.imageLoader
```

Optionally, you can create your own `ImageLoader` instance(s) and inject them with dependency injection:

`ImageLoader`s are designed to be shareable and are most efficient when you create a single instance and share it throughout your app. That said, you can also create your own `ImageLoader` instance(s):

```kotlin
val imageLoader = ImageLoader(context)
```

If you do not want the singleton `ImageLoader`, depend on `io.coil-kt:coil-base`.
If you do not want the singleton `ImageLoader`, depend on `io.coil-kt:coil-base` instead of `io.coil-kt:coil`.

#### Requests

Expand Down Expand Up @@ -89,9 +107,8 @@ Check out Coil's [full documentation here](https://coil-kt.github.io/coil/gettin

## Requirements

- AndroidX
- Min SDK 14+
- [Java 8+](https://coil-kt.github.io/coil/getting_started/#java-8)
- Min SDK 21+
- [Java 8+](https://coil-kt.github.io/coil/faq/#how-do-i-target-java-8)

## R8 / Proguard

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ import coil.size.Size as CoilSize
* constraint. For example, to use [AsyncImagePainter] with [LazyRow] or [LazyColumn], you must
* set a bounded width or height respectively.
* - [AsyncImagePainter.state] will not transition to [State.Success] synchronously during the
* composition phase. Use [SubcomposeAsyncImage] if you need this.
* composition phase. Use [SubcomposeAsyncImage] or set a custom [ImageRequest.Builder.size] value
* if you need this.
*
* @param model Either an [ImageRequest] or the [ImageRequest.data] value.
* @param imageLoader The [ImageLoader] that will be used to execute the request.
Expand Down Expand Up @@ -115,7 +116,8 @@ fun rememberAsyncImagePainter(
* constraint. For example, to use [AsyncImagePainter] with [LazyRow] or [LazyColumn], you must
* set a bounded width or height respectively.
* - [AsyncImagePainter.state] will not transition to [State.Success] synchronously during the
* composition phase. Use [SubcomposeAsyncImage] if you need this.
* composition phase. Use [SubcomposeAsyncImage] or set a custom [ImageRequest.Builder.size] value
* if you need this.
*
* @param model Either an [ImageRequest] or the [ImageRequest.data] value.
* @param imageLoader The [ImageLoader] that will be used to execute the request.
Expand Down
Loading

0 comments on commit 7013cdf

Please sign in to comment.