Skip to content
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

Async image update #1

Merged
merged 3 commits into from
Oct 19, 2017
Merged

Async image update #1

merged 3 commits into from
Oct 19, 2017

Conversation

bagintz
Copy link
Owner

@bagintz bagintz commented Oct 19, 2017

Summary

This PR has a new ChipSpan clone... UpdateableChipSpan which swaps out the Drawable Icon for a StateListDrawable. This StateListDrawable is initiated with the placeholder image (which is effectively the same as ChipSpan. Out of the box it will act the same as ChipSpan.

The difference is that you can use Picasso, Glide, Fresco or any other libraries that asynchronously return a drawable to update the Chip/ImageSpan by calling the new UpdateableChipSpan#changeIcon(Drawable newIcon) method. You must call NachoTextView#invalidateChips() on your NachoTextView for it to properly update the view.

It seems to work seamlessly with no side effects. I am sure there are more elegant ways to implement this, but it seemed the least invasive at the time.

*I noticed that the NachoTextView#init(AttributeSet attrs) defaults to the ChipSpan class, so I am not sure if there needs to be another method added there for this one????

Test Plan

Was going to duplicate the ChipSpanChipCreatorTest, but was unable to get it to pass locally so I am willing to write tests if I can get some direction/help with that

@bagintz bagintz merged commit f07bb10 into master Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant