TimeAnimatorpublic class TimeAnimator extends ValueAnimator This class provides a simple callback mechanism to listeners that is synchronized with all
other animators in the system. There is no duration, interpolation, or object value-setting
with this Animator. Instead, it is simply started, after which it proceeds to send out events
on every animation frame to its TimeListener (if set), with information about this animator,
the total elapsed time, and the elapsed time since the previous animation frame. |
Fields Summary |
---|
private TimeListener | mListener | private long | mPreviousTime |
Methods Summary |
---|
void | animateValue(float fraction)
// Noop
| boolean | animationFrame(long currentTime)
if (mListener != null) {
long totalTime = currentTime - mStartTime;
long deltaTime = (mPreviousTime < 0) ? 0 : (currentTime - mPreviousTime);
mPreviousTime = currentTime;
mListener.onTimeUpdate(this, totalTime, deltaTime);
}
return false;
| void | initAnimation()
// noop
| public void | setCurrentPlayTime(long playTime)
long currentTime = AnimationUtils.currentAnimationTimeMillis();
mStartTime = Math.max(mStartTime, currentTime - playTime);
animationFrame(currentTime);
| public void | setTimeListener(android.animation.TimeAnimator$TimeListener listener)Sets a listener that is sent update events throughout the life of
an animation.
mListener = listener;
| public void | start()
mPreviousTime = -1;
super.start();
|
|