diff --git a/Cargo.lock b/Cargo.lock index 6248192b16..0351e4b6d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2831,6 +2831,7 @@ dependencies = [ name = "integration" version = "0.1.0" dependencies = [ + "android-activity", "console_error_panic_hook", "console_log", "futures", diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 2b5f99e4f8..37fde3889b 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -15,6 +15,9 @@ iced_widget.features = ["wgpu"] futures.workspace = true futures.features = ["thread-pool"] +[target.'cfg(target_os = "android")'.dependencies] +android-activity = { version = "0.6.0", features = ["native-activity"] } + [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tracing-subscriber = "0.3" diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index 250918ab78..98c305a72f 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -205,21 +205,24 @@ pub fn window_event( WindowEvent::KeyboardInput { is_synthetic, .. } if is_synthetic => None, WindowEvent::KeyboardInput { event, .. } => Some(Event::Keyboard({ let key = { - #[cfg(not(target_arch = "wasm32"))] + #[cfg(not(any( + target_arch = "wasm32", + target_os = "android" + )))] { use winit::platform::modifier_supplement::KeyEventExtModifierSupplement; event.key_without_modifiers() } - #[cfg(target_arch = "wasm32")] + #[cfg(any(target_arch = "wasm32", target_os = "android"))] { - // TODO: Fix inconsistent API on Wasm + // TODO: Fix inconsistent API on Wasm and Android event.logical_key.clone() } }; let text = { - #[cfg(not(target_arch = "wasm32"))] + #[cfg(not(any(target_arch = "wasm32", target_os = "android")))] { use crate::core::SmolStr; use winit::platform::modifier_supplement::KeyEventExtModifierSupplement; @@ -227,9 +230,9 @@ pub fn window_event( event.text_with_all_modifiers().map(SmolStr::new) } - #[cfg(target_arch = "wasm32")] + #[cfg(any(target_arch = "wasm32", target_os = "android"))] { - // TODO: Fix inconsistent API on Wasm + // TODO: Fix inconsistent API on Wasm and Android event.text } }.filter(|text| !text.as_str().chars().any(is_private_use));