Loading libs/hwui/Animator.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -123,22 +123,27 @@ void BaseRenderNodeAnimator::resolveStagingRequest(Request request) { mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ? mPlayTime : 0; mPlayState = PlayState::Running; mPendingActionUponFinish = Action::None; break; case Request::Reverse: mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ? mPlayTime : mDuration; mPlayState = PlayState::Reversing; mPendingActionUponFinish = Action::None; break; case Request::Reset: mPlayTime = 0; mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::Reset; break; case Request::Cancel: mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::None; break; case Request::End: mPlayTime = mPlayState == PlayState::Reversing ? 0 : mDuration; mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::End; break; default: LOG_ALWAYS_FATAL("Invalid staging request: %d", static_cast<int>(request)); Loading Loading @@ -176,8 +181,6 @@ void BaseRenderNodeAnimator::pushStaging(AnimationContext& context) { mStagingRequests.clear(); if (mStagingPlayState == PlayState::Finished) { // Set the staging play time and end the animation updatePlayTime(mPlayTime); callOnFinishedListener(context); } else if (mStagingPlayState == PlayState::Running || mStagingPlayState == PlayState::Reversing) { Loading Loading @@ -236,6 +239,15 @@ bool BaseRenderNodeAnimator::animate(AnimationContext& context) { return false; } if (mPlayState == PlayState::Finished) { if (mPendingActionUponFinish == Action::Reset) { // Skip to start. updatePlayTime(0); } else if (mPendingActionUponFinish == Action::End) { // Skip to end. updatePlayTime(mDuration); } // Reset pending action. mPendingActionUponFinish = Action ::None; return true; } Loading libs/hwui/Animator.h +12 −1 Original line number Diff line number Diff line Loading @@ -165,6 +165,17 @@ private: Cancel, End }; // Defines different actions upon finish. enum class Action { // For animations that got canceled or finished normally. no more action needs to be done. None, // For animations that get reset, the reset will happen in the next animation pulse. Reset, // For animations being ended, in the next animation pulse the animation will skip to end. End }; inline void checkMutable(); virtual void transitionToRunning(AnimationContext& context); void doSetStartValue(float value); Loading @@ -172,7 +183,7 @@ private: void resolveStagingRequest(Request request); std::vector<Request> mStagingRequests; Action mPendingActionUponFinish = Action::None; }; class RenderPropertyAnimator : public BaseRenderNodeAnimator { Loading libs/hwui/AnimatorManager.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -83,12 +83,9 @@ void AnimatorManager::pushStaging() { } mNewAnimators.clear(); } if (mAnimators.size()) { for (auto& animator : mAnimators) { animator->pushStaging(mAnimationHandle->context()); } mParent.mProperties.updateMatrix(); } } void AnimatorManager::onAnimatorTargetChanged(BaseRenderNodeAnimator* animator) { Loading Loading
libs/hwui/Animator.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -123,22 +123,27 @@ void BaseRenderNodeAnimator::resolveStagingRequest(Request request) { mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ? mPlayTime : 0; mPlayState = PlayState::Running; mPendingActionUponFinish = Action::None; break; case Request::Reverse: mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ? mPlayTime : mDuration; mPlayState = PlayState::Reversing; mPendingActionUponFinish = Action::None; break; case Request::Reset: mPlayTime = 0; mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::Reset; break; case Request::Cancel: mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::None; break; case Request::End: mPlayTime = mPlayState == PlayState::Reversing ? 0 : mDuration; mPlayState = PlayState::Finished; mPendingActionUponFinish = Action::End; break; default: LOG_ALWAYS_FATAL("Invalid staging request: %d", static_cast<int>(request)); Loading Loading @@ -176,8 +181,6 @@ void BaseRenderNodeAnimator::pushStaging(AnimationContext& context) { mStagingRequests.clear(); if (mStagingPlayState == PlayState::Finished) { // Set the staging play time and end the animation updatePlayTime(mPlayTime); callOnFinishedListener(context); } else if (mStagingPlayState == PlayState::Running || mStagingPlayState == PlayState::Reversing) { Loading Loading @@ -236,6 +239,15 @@ bool BaseRenderNodeAnimator::animate(AnimationContext& context) { return false; } if (mPlayState == PlayState::Finished) { if (mPendingActionUponFinish == Action::Reset) { // Skip to start. updatePlayTime(0); } else if (mPendingActionUponFinish == Action::End) { // Skip to end. updatePlayTime(mDuration); } // Reset pending action. mPendingActionUponFinish = Action ::None; return true; } Loading
libs/hwui/Animator.h +12 −1 Original line number Diff line number Diff line Loading @@ -165,6 +165,17 @@ private: Cancel, End }; // Defines different actions upon finish. enum class Action { // For animations that got canceled or finished normally. no more action needs to be done. None, // For animations that get reset, the reset will happen in the next animation pulse. Reset, // For animations being ended, in the next animation pulse the animation will skip to end. End }; inline void checkMutable(); virtual void transitionToRunning(AnimationContext& context); void doSetStartValue(float value); Loading @@ -172,7 +183,7 @@ private: void resolveStagingRequest(Request request); std::vector<Request> mStagingRequests; Action mPendingActionUponFinish = Action::None; }; class RenderPropertyAnimator : public BaseRenderNodeAnimator { Loading
libs/hwui/AnimatorManager.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -83,12 +83,9 @@ void AnimatorManager::pushStaging() { } mNewAnimators.clear(); } if (mAnimators.size()) { for (auto& animator : mAnimators) { animator->pushStaging(mAnimationHandle->context()); } mParent.mProperties.updateMatrix(); } } void AnimatorManager::onAnimatorTargetChanged(BaseRenderNodeAnimator* animator) { Loading