Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

ObjectAnimator does not proxy View properties when created from PropertyValuesHolder #48

Open
dlew opened this issue May 24, 2013 · 1 comment

Comments

@dlew
Copy link

dlew commented May 24, 2013

I noticed this when I switched my code from using multiple ObjectAnimators to using a single ObjectAnimator + multiple PropertyValuesHolders.

This code will work:

ObjectAnimator.ofFloat(myView, "alpha", 0f, 1f).start();

This code will not work:

PropertyValuesHolder pvh = PropertyValuesHolder.ofFloat("alpha", 0f, 1f);
ObjectAnimator.ofPropertyValuesHolder(myView, pvh).start();

The culprit is pretty obvious, you see this in LogCat:

E/PropertyValuesHolder(4615): Couldn't find setter/getter for property alpha with value type float

It seems to me that PVH should be able to proxy a View's properties just as well as a vanilla ObjectAnimator. Obviously it's an extra layer of indirection but if ObjectAnimator can do it, PropertyValuesHolder should be able to do so as well.

@scottdweber
Copy link

It seems like this ought to be built into the library, but there is a workaround:

PropertyValuesHolder pvh = PropertyValuesHolder.ofFloat("alpha", 0f, 1f);
ObjectAnimator.ofPropertyValuesHolder(AnimatorProxy.NEEDS_PROXY ?
        AnimatorProxy.wrap(myView) : myView, pvh).start();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants