Skip to content
Commit c1ca6658 authored by Chet Haase's avatar Chet Haase
Browse files

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
parent ed734404
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment