From dd1dfb1fac6c9e97adcb1df21373d0d55bc8ea00 Mon Sep 17 00:00:00 2001 From: Piotr Podusowski Date: Sun, 10 Nov 2024 21:23:10 +0100 Subject: [PATCH 1/3] Use android-activity's show_soft_input to summon the keyboard. --- src/platform_impl/android/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 533316e62f..27be9baee7 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -921,7 +921,13 @@ impl CoreWindow for Window { fn set_ime_cursor_area(&self, _position: Position, _size: Size) {} - fn set_ime_allowed(&self, _allowed: bool) {} + fn set_ime_allowed(&self, allowed: bool) { + if allowed { + self.app.show_soft_input(true); + } else { + self.app.hide_soft_input(true); + } + } fn set_ime_purpose(&self, _purpose: ImePurpose) {} From 281b99afb12fbc7f923d6f527381ae32120a1c5a Mon Sep 17 00:00:00 2001 From: Piotr Podusowski Date: Mon, 11 Nov 2024 10:30:28 +0100 Subject: [PATCH 2/3] changelog updated with showing the soft keyboard on Android --- src/changelog/unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index 96721e4aa2..5bf152f5a2 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -59,6 +59,7 @@ changelog entry. - Implement `Clone`, `Copy`, `Debug`, `Deserialize`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd` and `Serialize` on many types. - Add `MonitorHandle::current_video_mode()`. +- On Android, the soft keyboard can now be shown using `Window::set_ime_allowed`. - Add basic iOS IME support. The soft keyboard can now be shown using `Window::set_ime_allowed`. - Add `ApplicationHandlerExtMacOS` trait, and a `macos_handler` method to `ApplicationHandler` which returns a `dyn ApplicationHandlerExtMacOS` which allows for macOS specific extensions to winit. - Add a `standard_key_binding` method to the `ApplicationHandlerExtMacOS` trait. This allows handling of standard keybindings such as "go to end of line" on macOS. From 613339bd30c511872cdd51f5007ae54d33db7017 Mon Sep 17 00:00:00 2001 From: Piotr Podusowski Date: Tue, 12 Nov 2024 19:39:40 +0100 Subject: [PATCH 3/3] update Android specific doc --- src/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window.rs b/src/window.rs index 544374da6c..f607018868 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1028,8 +1028,8 @@ pub trait Window: AsAny + Send + Sync { /// /// - **macOS:** IME must be enabled to receive text-input where dead-key sequences are /// combined. - /// - **iOS:** This will show / hide the soft keyboard. - /// - **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. /// /// [`Ime`]: crate::event::WindowEvent::Ime