rust-mobile/android-activity (android-activity)
### [`v0.6.0`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.6.0)
[Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0)
#### What's Changed
- Bump MSRV to 1.69.0 considering we can't build cargo ndk with 1.68 by [@rib](https://togithub.com/rib) in [https://github.com/rust-mobile/android-activity/pull/156](https://togithub.com/rust-mobile/android-activity/pull/156)
- Upgrade to `ndk-sys 0.6.0` and `ndk 0.9.0` by [@MarijnS95](https://togithub.com/MarijnS95) in [https://github.com/rust-mobile/android-activity/pull/155](https://togithub.com/rust-mobile/android-activity/pull/155)
- native-activity: Check for null `saved_state_in` pointer by [@skibon02](https://togithub.com/skibon02) in [https://github.com/rust-mobile/android-activity/pull/157](https://togithub.com/rust-mobile/android-activity/pull/157)
- Release 0.6.0 by [@rib](https://togithub.com/rib) in [https://github.com/rust-mobile/android-activity/pull/158](https://togithub.com/rust-mobile/android-activity/pull/158)
#### New Contributors
- [@skibon02](https://togithub.com/skibon02) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/157](https://togithub.com/rust-mobile/android-activity/pull/157)
**Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0
### [`v0.5.2`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.2): android-activity 0.5.2
[Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2)
#### What's Changed
- native-activity/input: AND with `EVENT_ACTION_MASK` when extracting MotionEvent action by [@ArthurCose](https://togithub.com/ArthurCose) in [https://github.com/rust-mobile/android-activity/pull/147](https://togithub.com/rust-mobile/android-activity/pull/147)
#### New Contributors
- [@ArthurCose](https://togithub.com/ArthurCose) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/147](https://togithub.com/rust-mobile/android-activity/pull/147)
**Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2
### [`v0.5.1`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.1): android-activity 0.5.1
[Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1)
##### Changed
- Avoids depending on default features for `ndk` crate to avoid pulling in any `raw-window-handle` dependencies ([#142](https://togithub.com/rust-mobile/android-activity/pull/142))
**Note:** Technically, this could be observed as a breaking change in case you were depending on the `rwh_06` feature that was enabled by default in the `ndk` crate. This could be observed via the `NativeWindow` type (exposed via `AndroidApp::native_window()`) no longer implementing `rwh_06::HasWindowHandle`.
In the unlikely case that you were depending on the `ndk`'s `rwh_06` API being enabled by default via `android-activity`'s `ndk` dependency, your crate should explicitly enable the `rwh_06` feature for the `ndk` crate.
As far as could be seen though, it's not expected that anything was depending on this (e.g. anything based on Winit enables the `ndk` feature based on an equivalent `winit` feature).
The benefit of the change is that it can help avoid a redundant `raw-window-handle 0.6` dependency in projects that still need to use older (non-default) `raw-window-handle` versions. (Though note that this may be awkward to achieve in practice since other crates that depend on the `ndk` are still likely to use default features and also pull in `raw-window-handles 0.6`)
- The IO thread now gets named `stdio-to-logcat` and main thread is named `android_main` ([#145](https://togithub.com/rust-mobile/android-activity/pull/145))
- Improved IO error handling in `stdio-to-logcat` IO loop. ([#133](https://togithub.com/rust-mobile/android-activity/pull/133))
#### New Contributors
- [@Vrixyz](https://togithub.com/Vrixyz) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/142](https://togithub.com/rust-mobile/android-activity/pull/142)
**Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1
### [`v0.5.0`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.0): android-activity 0.5.0
[Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.4.3...v0.5.0)
Probably the most notable (breaking) change in this release is the updated API for reading input events to better support being able to use other `AndroidApp` APIs while iterating input events, to support unicode character mapping for `Keycodes`.
The other big change with this release is the update of the `game-activity` backend, updating to GameActivity 2.0.2. Applications using the `game-activity` backend will need to ensure they pull in the corresponding 2.0.2 `.aar` from Google (For example, see https://github.com/rust-mobile/android-activity/blob/main/examples/agdk-mainloop/app/build.gradle)
##### Added
- Added `KeyEvent::meta_state()` for being able to query the state of meta keys, needed for character mapping ([#102](https://togithub.com/rust-mobile/android-activity/pull/102))
- Added `KeyCharacterMap` JNI bindings to the corresponding Android SDK API ([#102](https://togithub.com/rust-mobile/android-activity/pull/102))
- Added `AndroidApp::device_key_character_map()` for being able to get a `KeyCharacterMap` for a given `device_id` for unicode character mapping ([#102](https://togithub.com/rust-mobile/android-activity/pull/102))
Click here for an example of how to handle unicode character mapping:
```rust
let mut combining_accent = None;
// Snip
let combined_key_char = if let Ok(map) = app.device_key_character_map(device_id) {
match map.get(key_event.key_code(), key_event.meta_state()) {
Ok(KeyMapChar::Unicode(unicode)) => {
let combined_unicode = if let Some(accent) = combining_accent {
match map.get_dead_char(accent, unicode) {
Ok(Some(key)) => {
info!("KeyEvent: Combined '{unicode}' with accent '{accent}' to give '{key}'");
Some(key)
}
Ok(None) => None,
Err(err) => {
log::error!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}");
None
}
}
} else {
info!("KeyEvent: Pressed '{unicode}'");
Some(unicode)
};
combining_accent = None;
combined_unicode.map(|unicode| KeyMapChar::Unicode(unicode))
}
Ok(KeyMapChar::CombiningAccent(accent)) => {
info!("KeyEvent: Pressed 'dead key' combining accent '{accent}'");
combining_accent = Some(accent);
Some(KeyMapChar::CombiningAccent(accent))
}
Ok(KeyMapChar::None) => {
info!("KeyEvent: Pressed non-unicode key");
combining_accent = None;
None
}
Err(err) => {
log::error!("KeyEvent: Failed to get key map character: {err:?}");
combining_accent = None;
None
}
}
} else {
None
};
```
- Added `TextEvent` Input Method event for supporting text editing via virtual keyboards ([#24](https://togithub.com/rust-mobile/android-activity/pull/24))
- Added `MotionEvent::action_button()` exposing the button associated with button press/release actions ([#138](https://togithub.com/rust-mobile/android-activity/pull/138))
##### Changed
- rust-version bumped to 0.68 ([#123](https://togithub.com/rust-mobile/android-activity/pull/123))
- *Breaking*: update to `ndk 0.8` and `ndk-sys 0.5` ([#128](https://togithub.com/rust-mobile/android-activity/pull/128))
- GameActivity updated to 2.0.2 (requires the corresponding 2.0.2 `.aar` release from Google) ([#88](https://togithub.com/rust-mobile/android-activity/pull/88))
- `AndroidApp::input_events()` is replaced by `AndroidApp::input_events_iter()` ([#102](https://togithub.com/rust-mobile/android-activity/pull/102))
Click here for an example of how to use `input_events_iter()`:
```rust
match app.input_events_iter() {
Ok(mut iter) => {
loop {
let read_input = iter.next(|event| {
let handled = match event {
InputEvent::KeyEvent(key_event) => {
// Snip
}
InputEvent::MotionEvent(motion_event) => {
// Snip
}
event => {
// Snip
}
};
handled
});
if !read_input {
break;
}
}
}
Err(err) => {
log::error!("Failed to get input events iterator: {err:?}");
}
}
```
- The `Pointer` and `PointerIter` types from the `ndk` crate are no longer directly exposed in the public API ([#122](https://togithub.com/rust-mobile/android-activity/pull/122))
- All input API enums based on Android SDK enums have been made runtime extensible via hidden `__Unknown(u32)` variants ([#131](https://togithub.com/rust-mobile/android-activity/pull/131))
#### New Contributors
- [@lexi-the-cute](https://togithub.com/lexi-the-cute) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/88](https://togithub.com/rust-mobile/android-activity/pull/88)
- [@daxpedda](https://togithub.com/daxpedda) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/85](https://togithub.com/rust-mobile/android-activity/pull/85)
- [@fornwall](https://togithub.com/fornwall) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/124](https://togithub.com/rust-mobile/android-activity/pull/124)
**Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.4.3...v0.5.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
0.4
->0.6
Release Notes
rust-mobile/android-activity (android-activity)
### [`v0.6.0`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.6.0) [Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0) #### What's Changed - Bump MSRV to 1.69.0 considering we can't build cargo ndk with 1.68 by [@rib](https://togithub.com/rib) in [https://github.com/rust-mobile/android-activity/pull/156](https://togithub.com/rust-mobile/android-activity/pull/156) - Upgrade to `ndk-sys 0.6.0` and `ndk 0.9.0` by [@MarijnS95](https://togithub.com/MarijnS95) in [https://github.com/rust-mobile/android-activity/pull/155](https://togithub.com/rust-mobile/android-activity/pull/155) - native-activity: Check for null `saved_state_in` pointer by [@skibon02](https://togithub.com/skibon02) in [https://github.com/rust-mobile/android-activity/pull/157](https://togithub.com/rust-mobile/android-activity/pull/157) - Release 0.6.0 by [@rib](https://togithub.com/rib) in [https://github.com/rust-mobile/android-activity/pull/158](https://togithub.com/rust-mobile/android-activity/pull/158) #### New Contributors - [@skibon02](https://togithub.com/skibon02) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/157](https://togithub.com/rust-mobile/android-activity/pull/157) **Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0 ### [`v0.5.2`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.2): android-activity 0.5.2 [Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2) #### What's Changed - native-activity/input: AND with `EVENT_ACTION_MASK` when extracting MotionEvent action by [@ArthurCose](https://togithub.com/ArthurCose) in [https://github.com/rust-mobile/android-activity/pull/147](https://togithub.com/rust-mobile/android-activity/pull/147) #### New Contributors - [@ArthurCose](https://togithub.com/ArthurCose) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/147](https://togithub.com/rust-mobile/android-activity/pull/147) **Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2 ### [`v0.5.1`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.1): android-activity 0.5.1 [Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1) ##### Changed - Avoids depending on default features for `ndk` crate to avoid pulling in any `raw-window-handle` dependencies ([#142](https://togithub.com/rust-mobile/android-activity/pull/142)) **Note:** Technically, this could be observed as a breaking change in case you were depending on the `rwh_06` feature that was enabled by default in the `ndk` crate. This could be observed via the `NativeWindow` type (exposed via `AndroidApp::native_window()`) no longer implementing `rwh_06::HasWindowHandle`. In the unlikely case that you were depending on the `ndk`'s `rwh_06` API being enabled by default via `android-activity`'s `ndk` dependency, your crate should explicitly enable the `rwh_06` feature for the `ndk` crate. As far as could be seen though, it's not expected that anything was depending on this (e.g. anything based on Winit enables the `ndk` feature based on an equivalent `winit` feature). The benefit of the change is that it can help avoid a redundant `raw-window-handle 0.6` dependency in projects that still need to use older (non-default) `raw-window-handle` versions. (Though note that this may be awkward to achieve in practice since other crates that depend on the `ndk` are still likely to use default features and also pull in `raw-window-handles 0.6`) - The IO thread now gets named `stdio-to-logcat` and main thread is named `android_main` ([#145](https://togithub.com/rust-mobile/android-activity/pull/145)) - Improved IO error handling in `stdio-to-logcat` IO loop. ([#133](https://togithub.com/rust-mobile/android-activity/pull/133)) #### New Contributors - [@Vrixyz](https://togithub.com/Vrixyz) made their first contribution in [https://github.com/rust-mobile/android-activity/pull/142](https://togithub.com/rust-mobile/android-activity/pull/142) **Full Changelog**: https://github.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1 ### [`v0.5.0`](https://togithub.com/rust-mobile/android-activity/releases/tag/v0.5.0): android-activity 0.5.0 [Compare Source](https://togithub.com/rust-mobile/android-activity/compare/v0.4.3...v0.5.0) Probably the most notable (breaking) change in this release is the updated API for reading input events to better support being able to use other `AndroidApp` APIs while iterating input events, to support unicode character mapping for `Keycodes`. The other big change with this release is the update of the `game-activity` backend, updating to GameActivity 2.0.2. Applications using the `game-activity` backend will need to ensure they pull in the corresponding 2.0.2 `.aar` from Google (For example, see https://github.com/rust-mobile/android-activity/blob/main/examples/agdk-mainloop/app/build.gradle) ##### Added - Added `KeyEvent::meta_state()` for being able to query the state of meta keys, needed for character mapping ([#102](https://togithub.com/rust-mobile/android-activity/pull/102)) - Added `KeyCharacterMap` JNI bindings to the corresponding Android SDK API ([#102](https://togithub.com/rust-mobile/android-activity/pull/102)) - Added `AndroidApp::device_key_character_map()` for being able to get a `KeyCharacterMap` for a given `device_id` for unicode character mapping ([#102](https://togithub.com/rust-mobile/android-activity/pull/102))Click here for an example of how to handle unicode character mapping:
```rust let mut combining_accent = None; // Snip let combined_key_char = if let Ok(map) = app.device_key_character_map(device_id) { match map.get(key_event.key_code(), key_event.meta_state()) { Ok(KeyMapChar::Unicode(unicode)) => { let combined_unicode = if let Some(accent) = combining_accent { match map.get_dead_char(accent, unicode) { Ok(Some(key)) => { info!("KeyEvent: Combined '{unicode}' with accent '{accent}' to give '{key}'"); Some(key) } Ok(None) => None, Err(err) => { log::error!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}"); None } } } else { info!("KeyEvent: Pressed '{unicode}'"); Some(unicode) }; combining_accent = None; combined_unicode.map(|unicode| KeyMapChar::Unicode(unicode)) } Ok(KeyMapChar::CombiningAccent(accent)) => { info!("KeyEvent: Pressed 'dead key' combining accent '{accent}'"); combining_accent = Some(accent); Some(KeyMapChar::CombiningAccent(accent)) } Ok(KeyMapChar::None) => { info!("KeyEvent: Pressed non-unicode key"); combining_accent = None; None } Err(err) => { log::error!("KeyEvent: Failed to get key map character: {err:?}"); combining_accent = None; None } } } else { None }; ```Click here for an example of how to use `input_events_iter()`:
```rust match app.input_events_iter() { Ok(mut iter) => { loop { let read_input = iter.next(|event| { let handled = match event { InputEvent::KeyEvent(key_event) => { // Snip } InputEvent::MotionEvent(motion_event) => { // Snip } event => { // Snip } }; handled }); if !read_input { break; } } } Err(err) => { log::error!("Failed to get input events iterator: {err:?}"); } } ```Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.