Révision | fc421a51ef5da0b2baab3e69ef9543fe76f2a029 (tree) |
---|---|
l'heure | 2021-10-22 22:56:13 |
Auteur | Hotshot5000 <sebastian_bugiu@yaho...> |
Commiter | Hotshot5000 |
Update DefaultIOSInput.java
Added callback for when closing on screen keyboard.
@@ -425,13 +425,34 @@ public class DefaultIOSInput extends AbstractInput implements IOSInput { | ||
425 | 425 | |
426 | 426 | @Override |
427 | 427 | public boolean shouldReturn (UITextField textField) { |
428 | - if (keyboardCloseOnReturn) setOnscreenKeyboardVisible(false); | |
428 | + if (keyboardCloseOnReturn) { | |
429 | +// setOnscreenKeyboardVisible(false); | |
430 | + if (onScreenKeyboardCloser != null) { | |
431 | + onScreenKeyboardCloser.onShouldReturn(); | |
432 | + } | |
433 | + } | |
429 | 434 | inputProcessor.keyDown(Keys.ENTER); |
430 | 435 | inputProcessor.keyTyped((char)13); |
431 | 436 | Gdx.graphics.requestRendering(); |
432 | 437 | return false; |
433 | 438 | } |
434 | 439 | }; |
440 | + private OnScreenKeyboardCloser onScreenKeyboardCloser; | |
441 | + | |
442 | + /** | |
443 | + * Hack to get notified when the keyboard must be hidden. | |
444 | + */ | |
445 | + public interface OnScreenKeyboardCloser { | |
446 | + void onShouldReturn(); | |
447 | + } | |
448 | + | |
449 | + public OnScreenKeyboardCloser getOnScreenKeyboardCloser() { | |
450 | + return onScreenKeyboardCloser; | |
451 | + } | |
452 | + | |
453 | + public void setOnScreenKeyboardCloser(OnScreenKeyboardCloser onScreenKeyboardCloser) { | |
454 | + this.onScreenKeyboardCloser = onScreenKeyboardCloser; | |
455 | + } | |
435 | 456 | |
436 | 457 | @Override |
437 | 458 | public void setOnscreenKeyboardVisible (boolean visible) { |