public S hasStartTime(long time) { isNotNull(); long actualTime = actual.getStartTime(); assertThat(actualTime) // .overridingErrorMessage("Expected start time <%s> but was <%s>.", time, actualTime) // .isEqualTo(time); return myself; }
private void start() { startTime = animation.getStartTime(); startOffset = animation.getStartOffset(); Choreographer choreographer = ShadowChoreographer.getInstance(); if (animationRunner != null) { choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null); } animationRunner = this; int startDelay; if (startTime == Animation.START_ON_FIRST_FRAME) { startDelay = (int) startOffset; } else { startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis()); } choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay); }
@Override public void run() { // Abort if start time has been messed with, as this simulation is only designed to handle // standard situations. if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) && animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ? SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) && // We can't handle infinitely repeating animations in the current scheduling model, // so abort after one iteration. !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) { // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME startTime = animation.getStartTime(); elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS; ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null); } else { animationRunner = null; } } }
public S hasStartTime(long time) { isNotNull(); long actualTime = actual.getStartTime(); assertThat(actualTime) // .overridingErrorMessage("Expected start time <%s> but was <%s>.", time, actualTime) // .isEqualTo(time); return myself; }
private void start() { startTime = animation.getStartTime(); startOffset = animation.getStartOffset(); Choreographer choreographer = ShadowChoreographer.getInstance(); if (animationRunner != null) { choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null); } animationRunner = this; int startDelay; if (startTime == Animation.START_ON_FIRST_FRAME) { startDelay = (int) startOffset; } else { startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis()); } choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay); }
private void start() { startTime = animation.getStartTime(); startOffset = animation.getStartOffset(); Choreographer choreographer = ShadowChoreographer.getInstance(); if (animationRunner != null) { choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null); } animationRunner = this; int startDelay; if (startTime == Animation.START_ON_FIRST_FRAME) { startDelay = (int) startOffset; } else { startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis()); } choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay); }
private void start() { startTime = animation.getStartTime(); startOffset = animation.getStartOffset(); Choreographer choreographer = ShadowChoreographer.getInstance(); if (animationRunner != null) { choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null); } animationRunner = this; int startDelay; if (startTime == Animation.START_ON_FIRST_FRAME) { startDelay = (int) startOffset; } else { startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis()); } choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay); }
private void start() { startTime = animation.getStartTime(); startOffset = animation.getStartOffset(); Choreographer choreographer = ShadowChoreographer.getInstance(); if (animationRunner != null) { choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null); } animationRunner = this; int startDelay; if (startTime == Animation.START_ON_FIRST_FRAME) { startDelay = (int) startOffset; } else { startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis()); } choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay); }
/** * Returns the duration, which should be used for an animation, depending on whether a previous * animation is still running, or not. * * @param animatedView * The animated view as an instance of the class {@link View}. The view may not be null * @param animation * The animation as an instance of the class {@link DialogAnimation}. The animation may * not be null * @return The duration, which used for the given animation, in milliseconds as a {@link Long} * value */ private long getDuration(@NonNull final View animatedView, @NonNull final DialogAnimation animation) { double scale = 1; if (animatedView.getAnimation() != null) { scale = (double) (System.currentTimeMillis() - animatedView.getAnimation().getStartTime()) / (double) animatedView.getAnimation().getDuration(); animatedView.getAnimation().cancel(); } return Math.round(animation.getDuration() * scale); }
@Override public void run() { // Abort if start time has been messed with, as this simulation is only designed to handle // standard situations. if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) && animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ? SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) && // We can't handle infinitely repeating animations in the current scheduling model, // so abort after one iteration. !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) { // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME startTime = animation.getStartTime(); elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS; ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null); } else { animationRunner = null; } } }
static void addAnimation(View view, Animation animation, boolean first) { Animation previousAnimation = view.getAnimation(); if (previousAnimation == null || previousAnimation.getClass() == animation.getClass()) { if (animation.getStartTime() == Animation.START_ON_FIRST_FRAME) view.startAnimation(animation); else
@Override public void run() { // Abort if start time has been messed with, as this simulation is only designed to handle // standard situations. if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) && animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ? SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) && // We can't handle infinitely repeating animations in the current scheduling model, // so abort after one iteration. !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) { // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME startTime = animation.getStartTime(); elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS; ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null); } else { animationRunner = null; } } }
@Override public void run() { // Abort if start time has been messed with, as this simulation is only designed to handle // standard situations. if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) && animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ? SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) && // We can't handle infinitely repeating animations in the current scheduling model, // so abort after one iteration. !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) { // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME startTime = animation.getStartTime(); elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS; ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null); } else { animationRunner = null; } } }
@Override public void run() { // Abort if start time has been messed with, as this simulation is only designed to handle // standard situations. if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) && animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ? SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) && // We can't handle infinitely repeating animations in the current scheduling model, // so abort after one iteration. !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) { // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME startTime = animation.getStartTime(); elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS; ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null); } else { animationRunner = null; } } }