mPausedVDAnimators.clear();
}
+ // Move all the animators to the paused list, and send a delayed message to notify the finished
+ // listener.
+ void pauseAnimators() {
+ mPausedVDAnimators.insert(mRunningVDAnimators.begin(), mRunningVDAnimators.end());
+ for (auto& anim : mRunningVDAnimators) {
+ detachVectorDrawableAnimator(anim.get());
+ }
+ mRunningVDAnimators.clear();
+ }
+
void doAttachAnimatingNodes(AnimationContext* context) {
for (size_t i = 0; i < mPendingAnimatingRenderNodes.size(); i++) {
RenderNode* node = mPendingAnimatingRenderNodes[i].get();
postOnFinishedEvents();
}
- virtual void detachAnimators() override {
- mRootNode->detachAnimators();
+ virtual void pauseAnimators() override {
+ mRootNode->pauseAnimators();
}
virtual void callOnFinished(BaseRenderNodeAnimator* animator, AnimationListener* listener) {
virtual void destroy() {
AnimationContext::destroy();
- detachAnimators();
+ mRootNode->detachAnimators();
postOnFinishedEvents();
}
ANDROID_API virtual void destroy();
- ANDROID_API virtual void detachAnimators() {}
+ ANDROID_API virtual void pauseAnimators() {}
private:
friend class AnimationHandle;
void CanvasContext::stopDrawing() {
mRenderThread.removeFrameCallback(this);
- mAnimationContext->detachAnimators();
+ mAnimationContext->pauseAnimators();
}
void CanvasContext::notifyFramePending() {