@Override public void create () { Timer timer = new Timer(); Task task = timer.scheduleTask(new Task() { @Override public void run () { Gdx.app.log("TimerTest", "ping"); } }, 1, 1); Gdx.app.log("TimerTest","is task scheduled: "+String.valueOf(task.isScheduled())); } }
public void drag (InputEvent event, float x, float y, int pointer) { event.getListenerActor().localToActorCoordinates(scroll, tmpCoords.set(x, y)); if (tmpCoords.y >= scroll.getHeight()) { scrollDown.cancel(); if (!scrollUp.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollUp, tickSecs, tickSecs); } return; } else if (tmpCoords.y < 0) { scrollUp.cancel(); if (!scrollDown.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollDown, tickSecs, tickSecs); } return; } scrollUp.cancel(); scrollDown.cancel(); }
public void drag (InputEvent event, float x, float y, int pointer) { event.getListenerActor().localToActorCoordinates(scroll, tmpCoords.set(x, y)); if (tmpCoords.y >= scroll.getHeight()) { scrollDown.cancel(); if (!scrollUp.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollUp, tickSecs, tickSecs); } return; } else if (tmpCoords.y < 0) { scrollUp.cancel(); if (!scrollDown.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollDown, tickSecs, tickSecs); } return; } scrollUp.cancel(); scrollDown.cancel(); }
tapRectangleCenterX = x; tapRectangleCenterY = y; if (!longPressTask.isScheduled()) Timer.schedule(longPressTask, longPressSeconds);
public void drag (InputEvent event, float x, float y, int pointer) { event.getListenerActor().localToActorCoordinates(scroll, tmpCoords.set(x, y)); if (tmpCoords.x >= 0 && tmpCoords.x < scroll.getWidth()) { if (tmpCoords.y >= scroll.getHeight()) { scrollDown.cancel(); if (!scrollUp.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollUp, tickSecs, tickSecs); } return; } else if (tmpCoords.y < 0) { scrollUp.cancel(); if (!scrollDown.isScheduled()) { startTime = System.currentTimeMillis(); Timer.schedule(scrollDown, tickSecs, tickSecs); } return; } } scrollUp.cancel(); scrollDown.cancel(); }
private void cancelCurrentRepeatingKeyTask() { if (currentRepeatingKeyTask != null && currentRepeatingKeyTask.isScheduled()) { currentRepeatingKeyTask.cancel(); } }
private void scheduleCurrentRepeatingKeyTask() { if (currentRepeatingKeyTask != null && !currentRepeatingKeyTask.isScheduled()) { keyRepeatTimer.scheduleTask( currentRepeatingKeyTask, keyRepeatStartDelays.get(currentRepeatingGdxKeyCode, DEFAULT_KEY_REPEAT_START_DELAY_SECONDS), keyRepeatRates.get(currentRepeatingGdxKeyCode, DEFAULT_KEY_REPEAT_RATE_SECONDS)); } }
private void scheduleCurrentRepeatingKeyTask() { if (currentRepeatingKeyTask != null && !currentRepeatingKeyTask.isScheduled()) { keyRepeatTimer.scheduleTask( currentRepeatingKeyTask, keyRepeatStartDelays.get(currentRepeatingGdxKeyCode, DEFAULT_KEY_REPEAT_START_DELAY_SECONDS), keyRepeatRates.get(currentRepeatingGdxKeyCode, DEFAULT_KEY_REPEAT_RATE_SECONDS)); } }
@Override public void keyboardFocusChanged(FocusEvent event, Actor actor, boolean focused) { if (!focused && timerTask.isScheduled()) { // Focus lost - immediately send change event if pending timerTask.cancel(); onChanged(); } } };
private void cancelCurrentRepeatingKeyTask() { if (currentRepeatingKeyTask != null && currentRepeatingKeyTask.isScheduled()) { currentRepeatingKeyTask.cancel(); } }
@Override public void changed(ChangeEvent event, Actor actor) { if (timerTask.isScheduled()) { timerTask.cancel(); } timer.scheduleTask(timerTask, threshold); } };
tapRectangleCenterX = x; tapRectangleCenterY = y; if (!longPressTask.isScheduled()) Timer.schedule(longPressTask, longPressSeconds);
tapRectangleCenterX = x; tapRectangleCenterY = y; if (!longPressTask.isScheduled()) Timer.schedule(longPressTask, longPressSeconds);