mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
android: Forward suspended() and resumed() events and patch up platform-specific documentation (#3786)
Key them off of `onStop()` and `onStart()` which seems to match the other backends most closely. These [Android Activity lifecycle] events denote when the application is visible on-screen, and recommend that any heavy lifting for startup and shutdown happens here, as the application may be demoted to the background and later shut down entirely unless the user navigates back to it. [Android Activity lifecycle]: https://developer.android.com/guide/components/activities/activity-lifecycle
This commit is contained in:
@@ -218,11 +218,11 @@ impl EventLoop {
|
||||
app.memory_warning(&self.window_target);
|
||||
},
|
||||
MainEvent::Start => {
|
||||
// XXX: how to forward this state to applications?
|
||||
warn!("TODO: forward onStart notification to application");
|
||||
app.resumed(self.window_target());
|
||||
},
|
||||
MainEvent::Resume { .. } => {
|
||||
debug!("App Resumed - is running");
|
||||
// TODO: This is incorrect - will be solved in https://github.com/rust-windowing/winit/pull/3897
|
||||
self.running = true;
|
||||
},
|
||||
MainEvent::SaveState { .. } => {
|
||||
@@ -232,11 +232,11 @@ impl EventLoop {
|
||||
},
|
||||
MainEvent::Pause => {
|
||||
debug!("App Paused - stopped running");
|
||||
// TODO: This is incorrect - will be solved in https://github.com/rust-windowing/winit/pull/3897
|
||||
self.running = false;
|
||||
},
|
||||
MainEvent::Stop => {
|
||||
// XXX: how to forward this state to applications?
|
||||
warn!("TODO: forward onStop notification to application");
|
||||
app.suspended(self.window_target());
|
||||
},
|
||||
MainEvent::Destroy => {
|
||||
// XXX: maybe exit mainloop to drop things before being
|
||||
|
||||
Reference in New Issue
Block a user