mirror of
https://github.com/rust-mobile/android-activity.git
synced 2026-07-18 20:48:54 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d299300f4 | |||
| 0a87a84c57 | |||
| 7bd3ba6dde | |||
| 6a0197c28f | |||
| e5b8242ff2 |
@@ -17,7 +17,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# See top README for MSRV policy
|
# See top README for MSRV policy
|
||||||
rust-version: [1.68.0, stable]
|
rust-version: [1.69.0, stable]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.6.0] - 2024-04-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- rust-version bumped to 1.69.0 ([#156](https://github.com/rust-mobile/android-activity/pull/156))
|
||||||
|
- Upgrade to `ndk-sys 0.6.0` and `ndk 0.9.0` ([#155](https://github.com/rust-mobile/android-activity/pull/155))
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Check for null `saved_state_in` pointer from `NativeActivity`
|
||||||
|
|
||||||
## [0.5.2] - 2024-01-30
|
## [0.5.2] - 2024-01-30
|
||||||
|
|
||||||
@@ -176,21 +184,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Removed
|
### Removed
|
||||||
- Most of the examples were moved to <https://github.com/rust-mobile/rust-android-examples> ([#50](https://github.com/rust-mobile/android-activity/pull/50))
|
- Most of the examples were moved to <https://github.com/rust-mobile/rust-android-examples> ([#50](https://github.com/rust-mobile/android-activity/pull/50))
|
||||||
|
|
||||||
## [0.4] - 2022-11-10
|
## [0.4.0] - 2022-11-10
|
||||||
### Changed
|
### Changed
|
||||||
- *Breaking*: `input_events` callback now return whether an event was handled or not to allow for fallback handling ([#31](https://github.com/rust-mobile/android-activity/issues/31))
|
- *Breaking*: `input_events` callback now return whether an event was handled or not to allow for fallback handling ([#31](https://github.com/rust-mobile/android-activity/issues/31))
|
||||||
- The native-activity backend is now implemented in Rust only, without building on `android_native_app_glue.c` ([#35](https://github.com/rust-mobile/android-activity/pull/35))
|
- The native-activity backend is now implemented in Rust only, without building on `android_native_app_glue.c` ([#35](https://github.com/rust-mobile/android-activity/pull/35))
|
||||||
### Added
|
### Added
|
||||||
- Added `Pointer::tool_type()` API to `GameActivity` backend for compatibility with `ndk` events API ([#38](https://github.com/rust-mobile/android-activity/pull/38))
|
- Added `Pointer::tool_type()` API to `GameActivity` backend for compatibility with `ndk` events API ([#38](https://github.com/rust-mobile/android-activity/pull/38))
|
||||||
|
|
||||||
## [0.3] - 2022-09-15
|
## [0.3.0] - 2022-09-15
|
||||||
### Added
|
### Added
|
||||||
- `show/hide_sot_input` API for being able to show/hide a soft keyboard (other IME still pending)
|
- `show/hide_sot_input` API for being able to show/hide a soft keyboard (other IME still pending)
|
||||||
- `set_window_flags()` API for setting WindowManager params
|
- `set_window_flags()` API for setting WindowManager params
|
||||||
### Changed
|
### Changed
|
||||||
- *Breaking*: Created extensible, `#[non_exhaustive]` `InputEvent` wrapper enum instead of exposing `ndk` type directly
|
- *Breaking*: Created extensible, `#[non_exhaustive]` `InputEvent` wrapper enum instead of exposing `ndk` type directly
|
||||||
|
|
||||||
## [0.2] - 2022-08-25
|
## [0.2.0] - 2022-08-25
|
||||||
### Added
|
### Added
|
||||||
- Emit an `InputAvailable` event for new input with `NativeActivity` and `GameActivity`
|
- Emit an `InputAvailable` event for new input with `NativeActivity` and `GameActivity`
|
||||||
enabling gui apps that don't render continuously
|
enabling gui apps that don't render continuously
|
||||||
@@ -207,6 +215,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- Documentation fixes
|
- Documentation fixes
|
||||||
|
|
||||||
## [0.1] - 2022-07-04
|
## [0.1.0] - 2022-07-04
|
||||||
### Added
|
### Added
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
|
[unreleased]: https://github.com/rust-mobile/android-activity/compare/v0.6.0...HEAD
|
||||||
|
[0.6.0]: https://github.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0
|
||||||
|
[0.5.2]: https://github.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2
|
||||||
|
[0.5.1]: https://github.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1
|
||||||
|
[0.5.0]: https://github.com/rust-mobile/android-activity/compare/v0.4.3...v0.5.0
|
||||||
|
[0.4.3]: https://github.com/rust-mobile/android-activity/compare/v0.4.2...v0.4.3
|
||||||
|
[0.4.2]: https://github.com/rust-mobile/android-activity/compare/v0.4.1...v0.4.2
|
||||||
|
[0.4.1]: https://github.com/rust-mobile/android-activity/compare/v0.4.0...v0.4.1
|
||||||
|
[0.4.0]: https://github.com/rust-mobile/android-activity/compare/v0.3.0...v0.4.0
|
||||||
|
[0.3.0]: https://github.com/rust-mobile/android-activity/compare/v0.2.0...v0.3.0
|
||||||
|
[0.2.0]: https://github.com/rust-mobile/android-activity/compare/v0.1.1...v0.2.0
|
||||||
|
[0.1.1]: https://github.com/rust-mobile/android-activity/compare/v0.1.0...v0.1.1
|
||||||
|
[0.1.0]: https://github.com/rust-mobile/android-activity/releases/tag/v0.1.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "android-activity"
|
name = "android-activity"
|
||||||
version = "0.5.2"
|
version = "0.6.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["android", "ndk"]
|
keywords = ["android", "ndk"]
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
@@ -10,12 +10,12 @@ documentation = "https://docs.rs/android-activity"
|
|||||||
description = "Glue for building Rust applications on Android with NativeActivity or GameActivity"
|
description = "Glue for building Rust applications on Android with NativeActivity or GameActivity"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
# 1.68 was when Rust last updated the Android NDK version used to build the
|
# 1.69 was when Rust last updated the Android NDK version used to build the
|
||||||
# standard library which avoids needing the -lunwind workaround in build tools.
|
# standard library which avoids needing the -lunwind workaround in build tools.
|
||||||
#
|
#
|
||||||
# We depend on cargo-ndk for building which has dropped support for the above
|
# We depend on cargo-ndk for building which has dropped support for the above
|
||||||
# linker workaround.
|
# linker workaround.
|
||||||
rust-version = "1.68.0"
|
rust-version = "1.69.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Note: we don't enable any backend by default since features
|
# Note: we don't enable any backend by default since features
|
||||||
@@ -33,8 +33,8 @@ log = "0.4"
|
|||||||
jni-sys = "0.3"
|
jni-sys = "0.3"
|
||||||
cesu8 = "1"
|
cesu8 = "1"
|
||||||
jni = "0.21"
|
jni = "0.21"
|
||||||
ndk-sys = "0.5.0"
|
ndk-sys = "0.6.0"
|
||||||
ndk = { version = "0.8.0", default-features = false }
|
ndk = { version = "0.9.0", default-features = false }
|
||||||
ndk-context = "0.1"
|
ndk-context = "0.1"
|
||||||
android-properties = "0.2"
|
android-properties = "0.2"
|
||||||
num_enum = "0.7"
|
num_enum = "0.7"
|
||||||
|
|||||||
@@ -337,8 +337,12 @@ impl WaitableNativeActivityState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let saved_state =
|
let saved_state = if saved_state_in.is_null() {
|
||||||
unsafe { std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size) };
|
Vec::new()
|
||||||
|
} else {
|
||||||
|
unsafe { std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size) }
|
||||||
|
.to_vec()
|
||||||
|
};
|
||||||
|
|
||||||
let config = unsafe {
|
let config = unsafe {
|
||||||
let config = ndk_sys::AConfiguration_new();
|
let config = ndk_sys::AConfiguration_new();
|
||||||
@@ -357,7 +361,7 @@ impl WaitableNativeActivityState {
|
|||||||
msg_read: msgpipe[0],
|
msg_read: msgpipe[0],
|
||||||
msg_write: msgpipe[1],
|
msg_write: msgpipe[1],
|
||||||
config,
|
config,
|
||||||
saved_state: saved_state.into(),
|
saved_state,
|
||||||
input_queue: ptr::null_mut(),
|
input_queue: ptr::null_mut(),
|
||||||
window: None,
|
window: None,
|
||||||
content_rect: Rect::empty().into(),
|
content_rect: Rect::empty().into(),
|
||||||
|
|||||||
@@ -262,13 +262,8 @@ impl<'a> PointerImpl<'a> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn axis_value(&self, axis: Axis) -> f32 {
|
pub fn axis_value(&self, axis: Axis) -> f32 {
|
||||||
let value: u32 = axis.into();
|
let value: u32 = axis.into();
|
||||||
if let Ok(ndk_axis) = value.try_into() {
|
let value = value as i32;
|
||||||
self.ndk_pointer.axis_value(ndk_axis)
|
self.ndk_pointer.axis_value(value.into())
|
||||||
} else {
|
|
||||||
// FIXME: We should also be able to query `Axis::__Unknown(u32)` values
|
|
||||||
// that can't currently be queried via the `ndk` `Pointer` API
|
|
||||||
0.0f32
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -283,7 +278,8 @@ impl<'a> PointerImpl<'a> {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tool_type(&self) -> ToolType {
|
pub fn tool_type(&self) -> ToolType {
|
||||||
let value: u32 = self.ndk_pointer.tool_type().into();
|
let value: i32 = self.ndk_pointer.tool_type().into();
|
||||||
|
let value = value as u32;
|
||||||
value.into()
|
value.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -507,6 +507,7 @@ impl<'a> InputIteratorInner<'a> {
|
|||||||
ndk::event::InputEvent::KeyEvent(e) => {
|
ndk::event::InputEvent::KeyEvent(e) => {
|
||||||
input::InputEvent::KeyEvent(input::KeyEvent::new(e))
|
input::InputEvent::KeyEvent(input::KeyEvent::new(e))
|
||||||
}
|
}
|
||||||
|
_ => todo!("NDK added a new type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// `finish_event` needs to be called for each event otherwise
|
// `finish_event` needs to be called for each event otherwise
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ edition = "2021"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
android_logger = "0.11.0"
|
android_logger = "0.11.0"
|
||||||
android-activity = { path="../../android-activity", features = ["game-activity"] }
|
android-activity = { path="../../android-activity", features = ["game-activity"] }
|
||||||
ndk-sys = "0.5.0"
|
ndk-sys = "0.6.0"
|
||||||
ndk = "0.8.0"
|
ndk = "0.9.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name="main"
|
name="main"
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ edition = "2021"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
android_logger = "0.11.0"
|
android_logger = "0.11.0"
|
||||||
android-activity = { path="../../android-activity", features = [ "native-activity" ] }
|
android-activity = { path="../../android-activity", features = [ "native-activity" ] }
|
||||||
ndk-sys = "0.5.0"
|
ndk-sys = "0.6.0"
|
||||||
ndk = "0.8.0"
|
ndk = "0.9.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
#name="na_mainloop"
|
#name="na_mainloop"
|
||||||
|
|||||||
Reference in New Issue
Block a user