Android todo example: cleanup console output and remove warning

This commit is contained in:
Olivier Goffart 2024-01-05 15:39:01 +01:00
parent 4243040453
commit f495235b74
2 changed files with 3 additions and 4 deletions

View file

@ -110,7 +110,6 @@ fn android_main(app: i_slint_backend_android_activity::AndroidApp) {
use i_slint_backend_android_activity::android_activity::{MainEvent, PollEvent};
slint::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new_with_event_listener(app, |event| {
eprintln!("Got event: {event:?}");
match event {
PollEvent::Main(MainEvent::SaveState { saver, .. }) => {
STATE.with(|state| -> Option<()> {
@ -156,7 +155,7 @@ struct SerializedState {
#[cfg(target_os = "android")]
impl SerializedState {
fn restore(mut self, state: &State) {
fn restore(self, state: &State) {
state.todo_model.set_vec(self.items);
state.main_window.set_hide_done_items(self.hide_done);
state.main_window.set_is_sort_by_name(self.sort);

View file

@ -35,8 +35,8 @@ Below is an example of how to set up your `Cargo.toml`:
crate-type = ["cdylib"]
[dependencies]
slint = { version = "1.3.0", ... }
i-slint-backend-android-activity = { version = "=1.3.0", features = ["native-activity"] }
slint = { version = "1.3.2", ... }
i-slint-backend-android-activity = { version = "=1.3.2", features = ["native-activity"] }
```
As with any application using `android-activity`, you need to implement the `android_init` function as `#[no_mangle]`.