@Test public void cannotTickWhenUnscheduled() { StubAnimation a = new StubAnimation(l); try { a.tick(1.0); fail(); } catch (IllegalStateException ise) { assertThat(ise.getMessage(), is("Animation is not currently in progress")); } }
public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animation is not currently in progress"); } if (isFinished()) { throw new IllegalStateException("Animation is already finished"); } if (progress == 0.0) { logic.onStart(); } logic.onUpdate(logic.interpolate(progress)); if (progress == 1.0) { logic.onComplete(); } currentProgress = progress; }
StubAnimation implements IsAnimation { public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animation is not currently in progress"); } if (isFinished()) { throw new IllegalStateException("Animation is already finished"); } if (progress == 0.0) { logic.onStart(); } logic.onUpdate(logic.interpolate(progress)); if (progress == 1.0) { logic.onComplete(); } currentProgress = progress; } }
StubAnimation implements IsAnimation { public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animation is not currently in progress"); } if (isFinished()) { throw new IllegalStateException("Animation is already finished"); } if (progress == 0.0) { logic.onStart(); } logic.onUpdate(logic.interpolate(progress)); if (progress == 1.0) { logic.onComplete(); } currentProgress = progress; } StubAnimation(AnimationLogic logic); }
StubAnimation implements IsAnimation { public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animation is not currently in progress"); } if (isFinished()) { throw new IllegalStateException("Animation is already finished"); } if (progress == 0.0) { logic.onStart(); } logic.onUpdate(logic.interpolate(progress)); if (progress == 1.0) { logic.onComplete(); } currentProgress = progress; } StubAnimation(AnimationLogic logic); void tick(final double progress); @Override void doNotAutoFinish(); @Override void run(final int duration); int getRequestedDuration(); void setRequestedDuration(int requestedDuration); @Override void cancel(); @Override void setNewLogic(AnimationLogic logic); boolean isRunning(); boolean isCancelled(); boolean isFinished(); }
StubAnimation implements IsAnimation { public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animation is not currently in progress"); } if (isFinished()) { throw new IllegalStateException("Animation is already finished"); } if (progress == 0.0) { logic.onStart(); } logic.onUpdate(logic.interpolate(progress)); if (progress == 1.0) { logic.onComplete(); } currentProgress = progress; } StubAnimation(AnimationLogic logic); void tick(final double progress); @Override void doNotAutoFinish(); @Override void run(final int duration); int getRequestedDuration(); void setRequestedDuration(int requestedDuration); @Override void cancel(); @Override void setNewLogic(AnimationLogic logic); boolean isRunning(); boolean isCancelled(); boolean isFinished();  }