GetStream / avatarview-android

✨ Supports loading profile images with fractional styles, shapes, borders, indicators, and initials for Android.
https://getstream.github.io/avatarview-android/
Apache License 2.0
432 stars 26 forks source link

Data Loading Fail/Fallback to Initials #2

Closed yogeshpaliyal closed 2 years ago

yogeshpaliyal commented 2 years ago

Hi @skydoves

Is there any way, by that I can set a fallback to Initials. Like i provided HTTP Url and initial both. Expectation : Initially it should ajow initials when image is is downloaded then show image.

Current behaviour : If i gave both url and initials then it shows Initials always.

Correct me I missed something.

skydoves commented 2 years ago

Hey @yogeshpaliyal, Thanks for reporting this issue! We will add new onSuccess and onFailed listeners on the next release, it's available on the current 1.0.1-SNAPSHOT.

Example:

avatarView1.loadImage(
        cats.take(1),
        onSuccess = { _, _ ->
            // do something..
        },
        onError = { _, _ ->
            avatarView1.avatarInitials = "AA"
        }
)

You can import the SNAPSHOT version following this guide. Thanks!

skydoves commented 2 years ago

Hey @yogeshpaliyal, A new stable 1.0.1 has been released. If you face the same issue with my suggestion, please let me know again!

yogeshpaliyal commented 2 years ago

Thanks @skydoves for the update on this, will try this and let you know. 💚💙