v3.2.2: fixed iOS keyboard not showing return key for multiline

This commit is contained in:
Evan Debenham
2025-08-22 14:04:41 -04:00
parent 0b97ab0c7c
commit 9eaf2618f7
4 changed files with 17 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ public class PointerEvent {
} }
if (clearKeyboardThisPress){ if (clearKeyboardThisPress){
//most press events should clear the keyboard //most press events should clear the keyboard
Game.platform.setOnscreenKeyboardVisible(false); Game.platform.setOnscreenKeyboardVisible(false, false);
} }
} }
pointerEvents.clear(); pointerEvents.clear();

View File

@@ -141,13 +141,13 @@ public class TextInput extends Component {
textField.setOnscreenKeyboard(new TextField.OnscreenKeyboard() { textField.setOnscreenKeyboard(new TextField.OnscreenKeyboard() {
@Override @Override
public void show(boolean visible) { public void show(boolean visible) {
Game.platform.setOnscreenKeyboardVisible(visible); Game.platform.setOnscreenKeyboardVisible(visible, multiline);
} }
}); });
container.setActor(textField); container.setActor(textField);
stage.setKeyboardFocus(textField); stage.setKeyboardFocus(textField);
Game.platform.setOnscreenKeyboardVisible(true); Game.platform.setOnscreenKeyboardVisible(true, multiline);
} }
public void enterPressed(){ public void enterPressed(){
@@ -258,7 +258,7 @@ public class TextInput extends Component {
stage.dispose(); stage.dispose();
skin.dispose(); skin.dispose();
Game.inputHandler.removeInputProcessor(stage); Game.inputHandler.removeInputProcessor(stage);
Game.platform.setOnscreenKeyboardVisible(false); Game.platform.setOnscreenKeyboardVisible(false, false);
if (!DeviceCompat.isDesktop()) Game.platform.updateSystemUI(); if (!DeviceCompat.isDesktop()) Game.platform.updateSystemUI();
} }
} }

View File

@@ -22,6 +22,7 @@
package com.watabou.utils; package com.watabou.utils;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.PixmapPacker; import com.badlogic.gdx.graphics.g2d.PixmapPacker;
@@ -61,8 +62,9 @@ public abstract class PlatformSupport {
return Gdx.net.openURI( uri ); return Gdx.net.openURI( uri );
} }
public void setOnscreenKeyboardVisible(boolean value){ public void setOnscreenKeyboardVisible(boolean value, boolean multiline){
Gdx.input.setOnscreenKeyboardVisible(value); //by default ignore multiline
Gdx.input.setOnscreenKeyboardVisible(value, Input.OnscreenKeyboardType.Default);
} }
//TODO should consider spinning this into its own class, rather than platform support getting ever bigger //TODO should consider spinning this into its own class, rather than platform support getting ever bigger

View File

@@ -129,6 +129,15 @@ public class IOSPlatformSupport extends PlatformSupport {
OALSimpleAudio.sharedInstance().setHonorSilentSwitch(value); OALSimpleAudio.sharedInstance().setHonorSilentSwitch(value);
} }
public void setOnscreenKeyboardVisible(boolean value, boolean multiline){
if (multiline){
//iOS needs 'email' input type to display enter/return key for multiline =S
Gdx.input.setOnscreenKeyboardVisible(value, Input.OnscreenKeyboardType.Email);
} else {
super.setOnscreenKeyboardVisible(value, multiline);
}
}
/* FONT SUPPORT */ /* FONT SUPPORT */
//custom pixel font, for use with Latin and Cyrillic languages //custom pixel font, for use with Latin and Cyrillic languages