andkulikov / Transitions-Everywhere

Set of extra Transitions on top of Jetpack Transitions Library
Apache License 2.0
4.82k stars 486 forks source link

Recolor doesn't work when background color change #28

Closed xzchaoo closed 8 years ago

xzchaoo commented 9 years ago

I have my view's background changed from #SOME_ARGB to #ANOTHER_ARGB. But transition Recolor doesn't work for it.

andkulikov commented 9 years ago

Hello. Can you please provide code so i can test it?

xzchaoo commented 9 years ago

Hello, I found the reason. In the source code, in the method: Recolor.createAnimator

        if (startBackground instanceof ColorDrawable && endBackground instanceof ColorDrawable) {
            ColorDrawable startColor = (ColorDrawable) startBackground;
            ColorDrawable endColor = (ColorDrawable) endBackground;
            if (startColor.getColor() != endColor.getColor()) {
                endColor.setColor(startColor.getColor());
                changed = true;
                return ObjectAnimator.ofObject(endBackground, "color",
                        new ArgbEvaluator(), startColor.getColor(), endColor.getColor());
            }
        }

here is a mistake : "endColor.setColor(startColor.getColor());". It causes animating color from start color to same start color.

andkulikov commented 9 years ago

thanks! i will fix it in next release

andkulikov commented 8 years ago

released in 1.6.1