Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Mutate the arrow drawable to avoid inconsistent shared states
Browse files Browse the repository at this point in the history
As the arrow drawable is usually mutated by the animator, it's better to create a copy of its state to avoid animation gliches and arrows in inconsistent states.
  • Loading branch information
Angelo Marchesin committed May 24, 2019
1 parent f62f2fd commit 9e18b1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/src/main/java/org/angmarch/views/NiceSpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ private Drawable initArrowDrawable(int drawableTint) {
if (arrowDrawableResId == 0) return null;
Drawable drawable = ContextCompat.getDrawable(getContext(), arrowDrawableResId);
if (drawable != null) {
drawable = DrawableCompat.wrap(drawable);
// Gets a copy of this drawable as this is going to be mutated by the animator
drawable = DrawableCompat.wrap(drawable).mutate();
if (drawableTint != Integer.MAX_VALUE && drawableTint != 0) {
DrawableCompat.setTint(drawable, drawableTint);
}
Expand Down

0 comments on commit 9e18b1f

Please sign in to comment.