Beispiel #1
0
 /**
  * Hides the dialog. Called automatically when a button is clicked. The default implementation
  * fades out the dialog over 400 milliseconds and then removes it from the stage.
  */
 public void hide() {
   hide(
       sequence(
           fadeOut(0.4f, Interpolation.fade),
           Actions.removeListener(ignoreTouchDown, true),
           Actions.removeActor()));
 }
Beispiel #2
0
  /** Hides the dialog with the given action and then removes it from the stage. */
  public void hide(Action action) {
    Stage stage = getStage();
    if (stage != null) {
      removeListener(focusListener);
      if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null)
        previousKeyboardFocus = null;
      Actor actor = stage.getKeyboardFocus();
      if (actor == null || actor.isDescendantOf(this))
        stage.setKeyboardFocus(previousKeyboardFocus);

      if (previousScrollFocus != null && previousScrollFocus.getStage() == null)
        previousScrollFocus = null;
      actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
    }
    if (action != null) {
      addCaptureListener(ignoreTouchDown);
      addAction(
          sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
    } else remove();
  }
Beispiel #3
0
 protected void setStage(Stage stage) {
   if (stage == null) addListener(focusListener);
   else removeListener(focusListener);
   super.setStage(stage);
 }