public final void addCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline"); } this.callback.addCallback(callback); }
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { public void run() { // System.err.println("Timeline @" // + timeline.hashCode()); timeline.callback.onTimelinePulse( durationFraction, timelinePosition); } }); } else { // System.err.println("Timeline @" + timeline.hashCode()); timeline.callback.onTimelinePulse(durationFraction, timelinePosition); } } };
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { @Override public void run() { timeline.callback.onTimelineStateChanged( oldState, newState, durationFraction, timelinePosition); } }); } else { timeline.callback.onTimelineStateChanged(oldState, newState, durationFraction, timelinePosition); } } };
public Timeline(Object mainTimelineObject) { this.mainObject = mainTimelineObject; for (UIToolkitHandler uiToolkitHandler : TridentConfig.getInstance() .getUIToolkitHandlers()) { if (uiToolkitHandler.isHandlerFor(mainTimelineObject)) { this.uiToolkitHandler = uiToolkitHandler; break; } } // if the main timeline object is handled by a UI toolkit handler, // the setters registered with the different addProperty // APIs need to run with the matching threading policy TimelineCallback setterCallback = (this.uiToolkitHandler != null) ? new UISetter() : new Setter(); this.callback = new Chain(setterCallback); this.duration = 500; this.propertiesToInterpolate = new ArrayList<AbstractFieldInfo>(); this.id = Timeline.getId(); // this.loopsToLive = -1; this.stateStack = new Stack<TimelineState>(); this.stateStack.push(TimelineState.IDLE); this.doneCount = 0; this.ease = new Linear(); }
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { @Override public void run() { // System.err.println("Timeline @" // + timeline.hashCode()); timeline.callback.onTimelinePulse( durationFraction, timelinePosition); } }); } else { // System.err.println("Timeline @" + timeline.hashCode()); timeline.callback.onTimelinePulse(durationFraction, timelinePosition); } } };
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { public void run() { timeline.callback.onTimelineStateChanged( oldState, newState, durationFraction, timelinePosition); } }); } else { timeline.callback.onTimelineStateChanged(oldState, newState, durationFraction, timelinePosition); } } };
public Timeline(Object mainTimelineObject) { this.mainObject = mainTimelineObject; for (UIToolkitHandler uiToolkitHandler : TridentConfig.getInstance() .getUIToolkitHandlers()) { if (uiToolkitHandler.isHandlerFor(mainTimelineObject)) { this.uiToolkitHandler = uiToolkitHandler; break; } } // if the main timeline object is handled by a UI toolkit handler, // the setters registered with the different addProperty // APIs need to run with the matching threading policy TimelineCallback setterCallback = (this.uiToolkitHandler != null) ? new UISetter() : new Setter(); this.callback = new Chain(setterCallback); this.duration = 500; this.propertiesToInterpolate = new ArrayList<AbstractFieldInfo>(); this.id = Timeline.getId(); // this.loopsToLive = -1; this.stateStack = new Stack<TimelineState>(); this.stateStack.push(TimelineState.IDLE); this.doneCount = 0; this.ease = new Linear(); }
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { public void run() { // System.err.println("Timeline @" // + timeline.hashCode()); timeline.callback.onTimelinePulse( durationFraction, timelinePosition); } }); } else { // System.err.println("Timeline @" + timeline.hashCode()); timeline.callback.onTimelinePulse(durationFraction, timelinePosition); } } };
@Override public void run() { boolean shouldRunOnUIThread = false; Class<?> clazz = timeline.callback.getClass(); while ((clazz != null) && !shouldRunOnUIThread) { shouldRunOnUIThread = clazz .isAnnotationPresent(RunOnUIThread.class); clazz = clazz.getSuperclass(); } if (shouldRunOnUIThread && (timeline.uiToolkitHandler != null)) { timeline.uiToolkitHandler.runOnUIThread( timeline.mainObject, new Runnable() { public void run() { timeline.callback.onTimelineStateChanged( oldState, newState, durationFraction, timelinePosition); } }); } else { timeline.callback.onTimelineStateChanged(oldState, newState, durationFraction, timelinePosition); } } };
public Timeline(Object mainTimelineObject) { this.mainObject = mainTimelineObject; for (UIToolkitHandler uiToolkitHandler : TridentConfig.getInstance() .getUIToolkitHandlers()) { if (uiToolkitHandler.isHandlerFor(mainTimelineObject)) { this.uiToolkitHandler = uiToolkitHandler; break; } } // if the main timeline object is handled by a UI toolkit handler, // the setters registered with the different addProperty // APIs need to run with the matching threading policy TimelineCallback setterCallback = (this.uiToolkitHandler != null) ? new UISetter() : new Setter(); this.callback = new Chain(setterCallback); this.duration = 500; this.propertiesToInterpolate = new ArrayList<AbstractFieldInfo>(); this.id = Timeline.getId(); // this.loopsToLive = -1; this.stateStack = new Stack<TimelineState>(); this.stateStack.push(TimelineState.IDLE); this.doneCount = 0; this.ease = new Linear(); }
public final void addCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline [" + this.toString() + "]"); } this.callback.addCallback(callback); }
public final void removeCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline"); } this.callback.removeCallback(callback); }
public final void addCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline [" + this.toString() + "]"); } this.callback.addCallback(callback); }
public final void removeCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline [" + this.toString() + "]"); } this.callback.removeCallback(callback); }
public final void removeCallback(TimelineCallback callback) { if (this.getState() != TimelineState.IDLE) { throw new IllegalArgumentException( "Cannot change state of non-idle timeline [" + this.toString() + "]"); } this.callback.removeCallback(callback); }