Skip to content

Instantly share code, notes, and snippets.

@ttencate
Created April 28, 2016 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttencate/96e8896f944a097785caa0394f3e17dc to your computer and use it in GitHub Desktop.
Save ttencate/96e8896f944a097785caa0394f3e17dc to your computer and use it in GitHub Desktop.
addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (event.getTarget() == DefaultDialog.this && x < 0 || y < 0 || x > getWidth() || y > getHeight()) {
hide();
return true;
}
return false;
}
@Override
public boolean keyDown(InputEvent event, int keycode) {
switch (keycode) {
case Keys.BACK:
case Keys.ESCAPE:
hide();
}
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment