Giter Site home page Giter Site logo

Comments (5)

colinrtwhite avatar colinrtwhite commented on August 28, 2024 7

@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.

colinrtwhite avatar colinrtwhite commented on August 28, 2024 3

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.

mare011 avatar mare011 commented on August 28, 2024 2

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.

colinrtwhite avatar colinrtwhite commented on August 28, 2024

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.

mlilienberg avatar mlilienberg commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.