android: use show_soft_input to summon the keyboard

Route it via the `Window::set_ime_allowed` like on iOS.
This commit is contained in:
Piotr Podusowski
2024-11-13 12:43:59 +01:00
committed by Kirill Chibisov
parent bab2d82fd3
commit 1d18a6ca57
3 changed files with 10 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ changelog entry.
to fully disable the menu bar and dock in Borderless Fullscreen as commonly done in games. to fully disable the menu bar and dock in Borderless Fullscreen as commonly done in games.
- On X11, the `window` example now understands the `X11_VISUAL_ID` and `X11_SCREEN_ID` env - On X11, the `window` example now understands the `X11_VISUAL_ID` and `X11_SCREEN_ID` env
variables to test the respective modifiers of window creation. variables to test the respective modifiers of window creation.
- On Android, the soft keyboard can now be shown using `Window::set_ime_allowed`.
### Fixed ### Fixed

View File

@@ -908,7 +908,13 @@ impl Window {
pub fn set_ime_cursor_area(&self, _position: Position, _size: Size) {} pub fn set_ime_cursor_area(&self, _position: Position, _size: Size) {}
pub fn set_ime_allowed(&self, _allowed: bool) {} pub fn set_ime_allowed(&self, allowed: bool) {
if allowed {
self.app.show_soft_input(true);
} else {
self.app.hide_soft_input(true);
}
}
pub fn set_ime_purpose(&self, _purpose: ImePurpose) {} pub fn set_ime_purpose(&self, _purpose: ImePurpose) {}

View File

@@ -1274,7 +1274,8 @@ impl Window {
/// ///
/// - **macOS:** IME must be enabled to receive text-input where dead-key sequences are /// - **macOS:** IME must be enabled to receive text-input where dead-key sequences are
/// combined. /// combined.
/// - **iOS / Android / Web / Orbital:** Unsupported. /// - **iOS / Android:** This will show / hide the soft keyboard.
/// - **Web / Orbital:** Unsupported.
/// - **X11**: Enabling IME will disable dead keys reporting during compose. /// - **X11**: Enabling IME will disable dead keys reporting during compose.
/// ///
/// [`Ime`]: crate::event::WindowEvent::Ime /// [`Ime`]: crate::event::WindowEvent::Ime