Enum android_activity::MainEvent
source · #[non_exhaustive]pub enum MainEvent<'a> {
Show 17 variants
InputAvailable,
InitWindow {},
TerminateWindow {},
WindowResized {},
RedrawNeeded {},
ContentRectChanged {},
GainedFocus,
LostFocus,
ConfigChanged {},
LowMemory,
Start,
Resume {
loader: StateLoader<'a>,
},
SaveState {
saver: StateSaver<'a>,
},
Pause,
Stop,
Destroy,
InsetsChanged {},
}
Expand description
An application event delivered during AndroidApp::poll_events
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InputAvailable
New input events are available via AndroidApp::input_events_iter()
Note: Even if more input is received this event will not be resent
until AndroidApp::input_events_iter()
has been called, which enables
applications to batch up input processing without there being lots of
redundant event loop wake ups.
InitWindow
Command from main thread: a new NativeWindow
is ready for use. Upon
receiving this command, AndroidApp::native_window()
will return the new window
TerminateWindow
Command from main thread: the existing NativeWindow
needs to be
terminated. Upon receiving this command, AndroidApp::native_window()
still
returns the existing window; after returning from the AndroidApp::poll_events()
callback then AndroidApp::native_window()
will return None
.
WindowResized
Command from main thread: the current NativeWindow
has been resized.
Please redraw with its new size.
RedrawNeeded
Command from main thread: the current NativeWindow
needs to be redrawn.
You should redraw the window before the AndroidApp::poll_events()
callback returns in order to avoid transient drawing glitches.
ContentRectChanged
Command from main thread: the content area of the window has changed,
such as from the soft input window being shown or hidden. You can
get the new content rect by calling AndroidApp::content_rect()
GainedFocus
Command from main thread: the app’s activity window has gained input focus.
LostFocus
Command from main thread: the app’s activity window has lost input focus.
ConfigChanged
Command from main thread: the current device configuration has changed.
You can get a copy of the latest ndk::configuration::Configuration
by calling
AndroidApp::config()
LowMemory
Command from main thread: the system is running low on memory. Try to reduce your memory use.
Start
Command from main thread: the app’s activity has been started.
Resume
Command from main thread: the app’s activity has been resumed.
Fields
This variant is marked as non-exhaustive
loader: StateLoader<'a>
SaveState
Command from main thread: the app should generate a new saved state for itself, to restore from later if needed. If you have saved state, allocate it with malloc and place it in android_app.savedState with the size in android_app.savedStateSize. The will be freed for you later.
Fields
This variant is marked as non-exhaustive
saver: StateSaver<'a>
Pause
Command from main thread: the app’s activity has been paused.
Stop
Command from main thread: the app’s activity has been stopped.
Destroy
Command from main thread: the app’s activity is being destroyed, and waiting for the app thread to clean up and exit before proceeding.
InsetsChanged
Command from main thread: the app’s insets have changed.