summaryrefslogtreecommitdiff
path: root/libs/hwui/PropertyValuesAnimatorSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/PropertyValuesAnimatorSet.h')
-rw-r--r--libs/hwui/PropertyValuesAnimatorSet.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/libs/hwui/PropertyValuesAnimatorSet.h b/libs/hwui/PropertyValuesAnimatorSet.h
index c7ae7c0e8ce1..e208b08cc27a 100644
--- a/libs/hwui/PropertyValuesAnimatorSet.h
+++ b/libs/hwui/PropertyValuesAnimatorSet.h
@@ -26,12 +26,13 @@ namespace uirenderer {
class PropertyAnimator {
public:
PropertyAnimator(PropertyValuesHolder* holder, Interpolator* interpolator, nsecs_t startDelay,
- nsecs_t duration, int repeatCount);
+ nsecs_t duration, int repeatCount, RepeatMode repeatMode);
void setCurrentPlayTime(nsecs_t playTime);
nsecs_t getTotalDuration() {
return mTotalDuration;
}
- void setFraction(float fraction);
+ // fraction range: [0, 1], iteration range [0, repeatCount]
+ void setFraction(float fraction, long iteration);
private:
std::unique_ptr<PropertyValuesHolder> mPropertyValuesHolder;
@@ -40,9 +41,11 @@ private:
nsecs_t mDuration;
uint32_t mRepeatCount;
nsecs_t mTotalDuration;
- float mLatestFraction = 0.0f;
+ RepeatMode mRepeatMode;
+ double mLatestFraction = 0;
};
+// TODO: This class should really be named VectorDrawableAnimator
class ANDROID_API PropertyValuesAnimatorSet : public BaseRenderNodeAnimator {
public:
friend class PropertyAnimatorSetListener;
@@ -50,11 +53,19 @@ public:
void start(AnimationListener* listener);
void reverse(AnimationListener* listener);
+ virtual void reset() override;
+ virtual void end() override;
void addPropertyAnimator(PropertyValuesHolder* propertyValuesHolder,
Interpolator* interpolators, int64_t startDelays,
- nsecs_t durations, int repeatCount);
+ nsecs_t durations, int repeatCount, RepeatMode repeatMode);
virtual uint32_t dirtyMask();
+ bool isInfinite() { return mIsInfinite; }
+ void setVectorDrawable(VectorDrawableRoot* vd) { mVectorDrawable = vd; }
+ VectorDrawableRoot* getVectorDrawable() const { return mVectorDrawable.get(); }
+ AnimationListener* getOneShotListener() { return mOneShotListener.get(); }
+ void clearOneShotListener() { mOneShotListener = nullptr; }
+ uint32_t getRequestId() const { return mRequestId; }
protected:
virtual float getValue(RenderNode* target) const override;
@@ -69,6 +80,11 @@ private:
std::vector< std::unique_ptr<PropertyAnimator> > mAnimators;
float mLastFraction = 0.0f;
bool mInitialized = false;
+ sp<VectorDrawableRoot> mVectorDrawable;
+ bool mIsInfinite = false;
+ // This request id gets incremented (on UI thread only) when a new request to modfiy the
+ // lifecycle of an animation happens, namely when start/end/reset/reverse is called.
+ uint32_t mRequestId = 0;
};
class PropertyAnimatorSetListener : public AnimationListener {