summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-05-16 13:28:33 -0700
committerAlan Viverette <alanv@google.com>2014-05-16 13:28:33 -0700
commitad2f8e334f3ef22d3e412b0660a2e1f996f94116 (patch)
tree0f23be1a722743ed216713a00304c234a782aca3 /libs
parent891e65c5ceff6a7859afab34f75f149b3aefa0c6 (diff)
downloadframeworks_base-ad2f8e334f3ef22d3e412b0660a2e1f996f94116.zip
frameworks_base-ad2f8e334f3ef22d3e412b0660a2e1f996f94116.tar.gz
frameworks_base-ad2f8e334f3ef22d3e412b0660a2e1f996f94116.tar.bz2
Update ripple behavior, use render thread animation
Change-Id: Ib6bc1e08b05d29606f452961963d58b8fc866746
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/Animator.cpp26
-rw-r--r--libs/hwui/Animator.h10
2 files changed, 28 insertions, 8 deletions
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index 83eedfb..b80f7e9 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -37,7 +37,10 @@ BaseRenderNodeAnimator::BaseRenderNodeAnimator(float finalValue)
, mInterpolator(0)
, mPlayState(NEEDS_START)
, mStartTime(0)
- , mDuration(300){
+ , mDelayUntil(0)
+ , mDuration(300)
+ , mStartDelay(0) {
+
}
BaseRenderNodeAnimator::~BaseRenderNodeAnimator() {
@@ -49,10 +52,6 @@ void BaseRenderNodeAnimator::setInterpolator(Interpolator* interpolator) {
mInterpolator = interpolator;
}
-void BaseRenderNodeAnimator::setDuration(nsecs_t duration) {
- mDuration = duration;
-}
-
void BaseRenderNodeAnimator::setStartValue(float value) {
LOG_ALWAYS_FATAL_IF(mPlayState != NEEDS_START,
"Cannot set the start value after the animator has started!");
@@ -68,7 +67,24 @@ void BaseRenderNodeAnimator::setupStartValueIfNecessary(RenderNode* target, Tree
}
}
+void BaseRenderNodeAnimator::setDuration(nsecs_t duration) {
+ mDuration = duration;
+}
+
+void BaseRenderNodeAnimator::setStartDelay(nsecs_t startDelay) {
+ mStartDelay = startDelay;
+}
+
bool BaseRenderNodeAnimator::animate(RenderNode* target, TreeInfo& info) {
+ if (mPlayState == PENDING && mStartDelay > 0 && mDelayUntil == 0) {
+ mDelayUntil = info.frameTimeMs + mStartDelay;
+ return false;
+ }
+
+ if (mDelayUntil > info.frameTimeMs) {
+ return false;
+ }
+
if (mPlayState == PENDING) {
mPlayState = RUNNING;
mStartTime = info.frameTimeMs;
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h
index fe88cbf..7741617 100644
--- a/libs/hwui/Animator.h
+++ b/libs/hwui/Animator.h
@@ -44,6 +44,8 @@ public:
ANDROID_API void setInterpolator(Interpolator* interpolator);
ANDROID_API void setDuration(nsecs_t durationInMs);
ANDROID_API nsecs_t duration() { return mDuration; }
+ ANDROID_API void setStartDelay(nsecs_t startDelayInMs);
+ ANDROID_API nsecs_t startDelay() { return mStartDelay; }
ANDROID_API void setListener(AnimationListener* listener) {
mListener = listener;
}
@@ -82,10 +84,12 @@ private:
Interpolator* mInterpolator;
PlayState mPlayState;
- long mStartTime;
- long mDuration;
+ nsecs_t mStartTime;
+ nsecs_t mDelayUntil;
+ nsecs_t mDuration;
+ nsecs_t mStartDelay;
- sp<AnimationListener> mListener;
+ sp<AnimationListener> mListener;
};
class RenderPropertyAnimator : public BaseRenderNodeAnimator {