Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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