Example usage for com.badlogic.gdx.scenes.scene2d Stage unfocusAll

List of usage examples for com.badlogic.gdx.scenes.scene2d Stage unfocusAll

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Stage unfocusAll.

Prototype

public void unfocusAll() 

Source Link

Document

Removes the touch, keyboard, and scroll focused actors.

Usage

From source file:com.calanti.androidnativekeyboardinputtest.libgdxModified_1_9_3.CalTextField.java

License:Apache License

/** Focuses the next  If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
 * @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next(boolean up) {
    Stage stage = getStage();
    if (stage == null)
        return;/*from  ww  w.  j  a v  a  2 s.co  m*/
    getParent().localToStageCoordinates(tmp1.set(getX(), getY()));
    CalTextField textField = findNextTextField(stage.getActors(), null, tmp2, tmp1, up);
    if (textField == null) { // Try to wrap around.
        if (up)
            tmp1.set(Float.MIN_VALUE, Float.MIN_VALUE);
        else
            tmp1.set(Float.MAX_VALUE, Float.MAX_VALUE);
        textField = findNextTextField(getStage().getActors(), null, tmp2, tmp1, up);
    }
    if (textField != null) {
        stage.setKeyboardFocus(textField);
        /** calanti addition - send EditText focus to next */
        if (androidTextInputInterface != null) {
            androidTextInputInterface.requestKeyboard(textField);
        }
    } else {
        /** calanti addition - also tell stage to unfocus */
        if (androidTextInputInterface != null) {
            androidTextInputInterface.forceHideKeyboard();
        } else {
            Gdx.input.setOnscreenKeyboardVisible(false);
        }
        stage.unfocusAll();
    }
}

From source file:es.eucm.ead.editor.control.MokapViews.java

License:Open Source License

public void hideOnscreenKeyboard() {
    Gdx.input.setOnscreenKeyboardVisible(false);
    Stage stage = modalsContainer.getStage();
    if (stage != null) {
        stage.setKeyboardFocus(null);/*from   w ww. j  a  va  2 s. c om*/
        stage.unfocusAll();
    }
}