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 {},
}Variants (Non-exhaustive)
This enum is marked as non-exhaustive
InputAvailable
New input events are available via AndroidApp::input_events()
Note: Even if more input is received this event will not be resent
until AndroidApp::input_events() has been called, which enables
applications to batch up input processing without there being lots of
redundant event loop wake ups.
InitWindow
Fields
This variant is marked as non-exhaustive
Command from main thread: a new NativeWindow is ready for use. Upon
receiving this command, AndroidApp::native_window() will return the new window
TerminateWindow
Fields
This variant is marked as non-exhaustive
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
Fields
This variant is marked as non-exhaustive
Command from main thread: the current NativeWindow has been resized.
Please redraw with its new size.
RedrawNeeded
Fields
This variant is marked as non-exhaustive
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
Fields
This variant is marked as non-exhaustive
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
Fields
This variant is marked as non-exhaustive
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
Fields
This variant is marked as non-exhaustive
loader: StateLoader<'a>Command from main thread: the app’s activity has been resumed.
SaveState
Fields
This variant is marked as non-exhaustive
saver: StateSaver<'a>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.
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
Fields
This variant is marked as non-exhaustive
Command from main thread: the app’s insets have changed.