Comments (5)
@mlilienberg Great point. I think it makes sense to use the same API as Glide. i.e.:
imageView.load(itemModel.imageUrl) {
placeholder(R.drawable.ic_placeholder)
error(R.drawable.ic_error)
fallback(R.drawable.ic_error)
}
Similar to placeholder
and error
, you should be able to set the default fallback
on your ImageLoader
.
from coil.
This is now supported in master. To get the fix asap you can depend on 0.9.0-SNAPSHOT
.
NOTE: There might be minor behaviour changes to the feature before 0.9.0
stable.
from coil.
To me it would make more sense to use error when defined, and placehold as a fallback. Same goes for the case where you do have an url and there's an error.
from coil.
To help design this, if you run:
imageView.load(null) {
placeholder(R.drawable.placeholder)
error(R.drawable.error)
}
Would you expect it to show the placeholder drawable or the error drawable?
from coil.
I saw multiple points of view about this topic. Some people think that null is a valid case and should show nothing. Maybe it makes more sense to define your own null strategy.
imageView.load(itemModel.imageUrl) {
placeholder(R.drawable.ic_placeholder)
error(R.drawable.ic_error)
isNull(R.drawable.ic_null)
}
or
imageView.load(itemModel.imageUrl) {
placeholder(R.drawable.ic_placeholder)
error(R.drawable.ic_error)
isNull(null)
}
Related topic in glide a few years ago:
bumptech/glide#268
from coil.
Related Issues (20)
- 新增浏览器快捷操作
- Image is flickering in compose horizontal view HOT 2
- Update NetworkObserver to call connectivityManager.registerDefaultNetworkCallback instead of connectivityManager.registerNetworkCallback HOT 3
- Coil3 alpha-08 not compatible with ktor 3.0-beta02 HOT 2
- Turn off network cache, clear app file will not be able to load images HOT 1
- Investigate SieveCache as coil memory cache for better performance HOT 6
- Why does Coil always refresh when loading different images with the same URL by default? Is it a bug? HOT 1
- Support fonts on SVG files HOT 1
- ImageBitmap Support for multiplatform HOT 2
- coil-network-ktor3 version: 3.0.0-alpha09 causes Ktor HttpClient to crash HOT 2
- Green overlay on images with AVIF format HOT 6
- [wasmJS] Build Error. HOT 1
- [Coil-3] SVG flickering while scrolling HOT 2
- Coil 3: Differing APIs make writing multiplatform code fiddly HOT 3
- Coil disk cache doesn't work when loading an icon file manually HOT 1
- Coil with web view for caching image HOT 1
- [Coil 3] Frequent `ImageDecoder$DecodeException: Input was incomplete.` when displaying an Uri from the Android PhotoPicker in Compose Multiplatform. HOT 7
- [Coil 3] Image Loading Silently Fails on Desktop HOT 4
- coil.request.NullRequestDataException: The request's data is null. HOT 1
- Web client fails due to CORS policy HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coil.