-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use placeholderRes/errorRes if url is null #61
Comments
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? |
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. |
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.
or
Related topic in glide a few years ago: |
@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 |
This is now supported in master. To get the fix asap you can depend on NOTE: There might be minor behaviour changes to the feature before |
It would be cool if passing null url would use placeholder drawable or error drawable if set. Right now it defeats the purpose of fluent api when you have to do something like:
if (imageUrl != null) { it.load(imageUrl) { placeholder(placeholderRes) } } else { it.setImageResource(placeholderRes) }
The text was updated successfully, but these errors were encountered: