public S hasStartOffset(long offset) { isNotNull(); long actualOffset = actual.getStartOffset(); assertThat(actualOffset) // .overridingErrorMessage("Expected start offset <%s> but was <%s>.", offset, actualOffset) // .isEqualTo(offset); return myself; }
private void animateOut(){ ActionMenuView menuView = getMenuView(); int count = menuView == null ? 0 : menuView.getChildCount(); Animation slowestAnimation = null; mAnimations.clear(); mAnimations.ensureCapacity(count); for(int i = 0; i < count; i++){ View child = menuView.getChildAt(i); Animation anim = mAnimator.getOutAnimation(child, i); mAnimations.add(anim); if(anim != null) if(slowestAnimation == null || slowestAnimation.getStartOffset() + slowestAnimation.getDuration() < anim.getStartOffset() + anim.getDuration()) slowestAnimation = anim; } if(slowestAnimation == null) mOutAnimationEndListener.onAnimationEnd(null); else { slowestAnimation.setAnimationListener(mOutAnimationEndListener); for(int i = 0; i < count; i++){ Animation anim = mAnimations.get(i); if(anim != null) menuView.getChildAt(i).startAnimation(anim); } } mAnimations.clear(); }
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 hasStartOffset(long offset) { isNotNull(); long actualOffset = actual.getStartOffset(); assertThat(actualOffset) // .overridingErrorMessage("Expected start offset <%s> but was <%s>.", offset, actualOffset) // .isEqualTo(offset); return myself; }
Animation a = //initialize here a.setStartOffset(2000); a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { a.setStartOffset(a.getStartOffset() == 2000 ? 4000 : 2000); a.start(); } @Override public void onAnimationRepeat(Animation animation) { } }); a.start();
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); }
@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; } } }
@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; } } }