diff options
author | John Reck <jreck@google.com> | 2014-06-24 15:34:58 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-06-26 10:45:43 -0700 |
commit | 68bfe0a37a0dcef52abd81688d8520c5d16e1a85 (patch) | |
tree | b67e0671dba8221a16fcf880daeaf1e271499e9f /libs/hwui/Animator.h | |
parent | 6507f2e03a90244e08fb62f9b55653ba3230d0b7 (diff) |
Animator refactoring & fixes
Tweaks animators to have less unnecessary refcounting
Pull animator management out into seperate class
More control to tweak animator lifecycle, such as doing
Java-side handling of start delay by attaching but not
starting the animator
Change-Id: I4ff8207580ca11fb38f45ef0007b406e0097281c
Diffstat (limited to 'libs/hwui/Animator.h')
-rw-r--r-- | libs/hwui/Animator.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h index 6cb72c4ccb02..a981b5a7d4af 100644 --- a/libs/hwui/Animator.h +++ b/libs/hwui/Animator.h @@ -50,12 +50,11 @@ public: ANDROID_API void setListener(AnimationListener* listener) { mListener = listener; } + ANDROID_API void start() { mStagingPlayState = RUNNING; } + ANDROID_API void cancel() { mStagingPlayState = FINISHED; } - ANDROID_API virtual void onAttached(RenderNode* target) {} - - // Guaranteed to happen before the staging push - void setupStartValueIfNecessary(RenderNode* target, TreeInfo& info); - + virtual void onAttached(RenderNode* target) {} + virtual void pushStaging(RenderNode* target, TreeInfo& info); bool animate(RenderNode* target, TreeInfo& info); bool isFinished() { return mPlayState == FINISHED; } @@ -73,8 +72,7 @@ protected: void callOnFinishedListener(TreeInfo& info); enum PlayState { - NEEDS_START, - PENDING, + NOT_STARTED, RUNNING, FINISHED, }; @@ -84,13 +82,19 @@ protected: float mFromValue; Interpolator* mInterpolator; + PlayState mStagingPlayState; PlayState mPlayState; + bool mHasStartValue; nsecs_t mStartTime; - nsecs_t mDelayUntil; nsecs_t mDuration; nsecs_t mStartDelay; sp<AnimationListener> mListener; + +private: + void doSetStartValue(float value); + inline void checkMutable(); + void transitionToRunning(TreeInfo& info); }; class RenderPropertyAnimator : public BaseRenderNodeAnimator { @@ -112,7 +116,7 @@ public: ANDROID_API RenderPropertyAnimator(RenderProperty property, float finalValue); - ANDROID_API virtual void onAttached(RenderNode* target); + virtual void onAttached(RenderNode* target); ANDROID_API virtual uint32_t dirtyMask(); |