Coil 2.0.0 is a major iteration of the library and includes breaking changes. Check out the upgrade guide for how to upgrade.
New Introduce AsyncImage in coil-compose. Check out the documentation for more info.
// Display an image from the network.
AsyncImage(
model = "https://example.com/image.jpg",
contentDescription = null
)
// Display an image from the network with a placeholder, circle crop, and crossfade animation.
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data("https://example.com/image.jpg")
.crossfade(true)
.build(),
placeholder = painterResource(R.drawable.placeholder),
contentDescription = stringResource(R.string.description),
contentScale = ContentScale.Crop,
modifier = Modifier.clip(CircleShape)
)
New Introduce a public DiskCache API.
Use ImageLoader.Builder.diskCache and DiskCache.Builder to configure the disk cache.
You should not use OkHttp's Cache with Coil 2.0. See here for more info.
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.
The minimum supported API is now 21.
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.
Add ImageSource, which allows Decoders to read Files directly using Okio's file system API.
Rework the Jetpack Compose integration:
rememberImagePainter and ImagePainter have been renamed to rememberAsyncImagePainter and AsyncImagePainter respectively.
Deprecate LocalImageLoader. Check out the deprecation message for more info.
Disable generating runtime not-null assertions.
If you use Java, passing null as a not-null annotated argument 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.
Size is now composed of two Dimension values for its width and height. Dimension can either be a positive pixel value or Dimension.Undefined. See here for more info.
BitmapPool and PoolableViewTarget have been removed from the library.
VideoFrameFileFetcher and VideoFrameUriFetcher have been removed from the library. Use VideoFrameDecoder instead, which supports all data sources.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps coil-compose from 1.4.0 to 2.0.0.
Release notes
Sourced from coil-compose's releases.
Changelog
Sourced from coil-compose's changelog.
... (truncated)
Commits
cc7c05a
Prepare 2.0.0. (#1251)cbf1d0d
Update dependency com.android.tools.build:gradle to v7.2.0 (#1265)faad4f9
Fix not combining headers if response is not modified. (#1261)8075f5c
Fix applying ImageView.load builder argument first instead of last. (#1260)fe231c3
Update dependency com.google.android.material:material to v1.6.0 (#1258)f856b33
Update dependency org.robolectric:robolectric to v4.8.1 (#1255)b6cb373
Update plugin ktlint to v10.3.0 (#1254)2a72db4
Update dependency org.robolectric:robolectric to v4.8 (#1253)34e8f32
Convert Dimension.Original to be Dimension.Undefined. (#1250)d022725
Load images with Size.ORIGINAL if ContentScale is None. (#1249)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)