Skip to content
Snippets Groups Projects
Commit 5af35424 authored by Rebekka Aashaug Stangvik's avatar Rebekka Aashaug Stangvik
Browse files

fixed keyboard go down when "enter" for android simulator on pc

parent dd5d2838
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,7 @@ public class JoinGameView { ...@@ -109,7 +109,7 @@ public class JoinGameView {
TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle(); TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle();
textFieldStyle.font = font; textFieldStyle.font = font;
textFieldStyle.fontColor = Color.WHITE; textFieldStyle.fontColor = Color.BLACK;
nicknameField = new TextField("", textFieldStyle); nicknameField = new TextField("", textFieldStyle);
nicknameField.setMessageText("Enter Nickname"); nicknameField.setMessageText("Enter Nickname");
...@@ -121,6 +121,8 @@ public class JoinGameView { ...@@ -121,6 +121,8 @@ public class JoinGameView {
pinField.setAlignment(1); // 1 = Center pinField.setAlignment(1); // 1 = Center
pinField.setMaxLength(4); // Max chars set to 4 pinField.setMaxLength(4); // Max chars set to 4
addTextFieldListeners();
// Set the position and size of the nicknameField // Set the position and size of the nicknameField
...@@ -135,9 +137,27 @@ public class JoinGameView { ...@@ -135,9 +137,27 @@ public class JoinGameView {
nicknameMessage=""; nicknameMessage="";
pinMessage=""; pinMessage="";
}
//help for android simulator on pc to get keyboard down
private void addTextFieldListeners() {
nicknameField.setTextFieldListener(new TextField.TextFieldListener() {
@Override
public void keyTyped(TextField textField, char c) {
if (c == '\n') {
Gdx.input.setOnscreenKeyboardVisible(false);
}
}
});
pinField.setTextFieldListener(new TextField.TextFieldListener() {
@Override
public void keyTyped(TextField textField, char c) {
if (c == '\n') {
Gdx.input.setOnscreenKeyboardVisible(false);
}
}
});
} }
public Rectangle getGoBackButtonBounds() { public Rectangle getGoBackButtonBounds() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment