Add new ViewPropertyAnimator utility methods
Users have requested the ability to sequence ViewPropertyAnimator animations. it is not possible with AnimatorSet, which only takes objects of type Animator (which VPA does not extend). But the AnimatorSet model is not appropriate for VPA anyway, since it is not possible to set up a VPA ahead of time to start later; it's just not the way that VPA is intended to work. Instead, there are now two new methods on VPA, onStart() and onEnd(). These methods take a Runnable which is executed when the animation starts or ends. These methods should allow other VPAs or other arbitrary code to execute at the start or finish of any particular VPA animation, allowing simple sequencing without the overhead of creating listeners and monitoring the cancelation status of the VPA. Additionally, this change adds a new method withLayer() which sets a hardware layer on the VPA's target view for the duration of the animation. This was already possible, but required writing boilerplate code to create a listener and override the start/end methods to add and remove the layer. This utility method makes this common use case much simpler and less error-prone. Change-Id: I819978517e17c647ffb7028063cd0adde68ff691
Loading
Please register or sign in to comment