pub struct AndroidPlatform { /* private fields */ }
Implementations§
source§impl AndroidPlatform
impl AndroidPlatform
sourcepub fn new(app: AndroidApp) -> Self
pub fn new(app: AndroidApp) -> Self
Instantiate a new Android backend given the android_activity::AndroidApp
Pass the returned value to slint::platform::set_platform()
§Example
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app: i_slint_backend_android_activity::AndroidApp) {
slint::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new(app),
))
.unwrap();
// ... your slint application ...
}
sourcepub fn new_with_event_listener(
app: AndroidApp,
listener: impl Fn(&PollEvent<'_>) + 'static
) -> Self
pub fn new_with_event_listener( app: AndroidApp, listener: impl Fn(&PollEvent<'_>) + 'static ) -> Self
Instantiate a new Android backend given the android_activity::AndroidApp
and a function to process the events.
This is the same as AndroidPlatform::new()
, but it allow you to get notified
of events.
Pass the returned value to slint::platform::set_platform()
§Example
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app: i_slint_backend_android_activity::AndroidApp) {
slint::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new_with_event_listener(
app,
|event| { eprintln!("got event {event:?}") }
),
))
.unwrap();
// ... your slint application ...
}
Trait Implementations§
source§impl Platform for AndroidPlatform
impl Platform for AndroidPlatform
source§fn create_window_adapter(&self) -> Result<Rc<dyn WindowAdapter>, PlatformError>
fn create_window_adapter(&self) -> Result<Rc<dyn WindowAdapter>, PlatformError>
Instantiate a window for a component.
source§fn run_event_loop(&self) -> Result<(), PlatformError>
fn run_event_loop(&self) -> Result<(), PlatformError>
Spins an event loop and renders the visible windows.
source§fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>>
fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>>
Return an [
EventLoopProxy
] that can be used to send event to the event loop Read more§fn duration_since_start(&self) -> Duration
fn duration_since_start(&self) -> Duration
Returns the current time as a monotonic duration since the start of the program Read more
§fn click_interval(&self) -> Duration
fn click_interval(&self) -> Duration
Returns the current interval to internal measure the duration to send a double click event. Read more
§fn set_clipboard_text(&self, _text: &str, _clipboard: Clipboard)
fn set_clipboard_text(&self, _text: &str, _clipboard: Clipboard)
Sends the given text into the system clipboard. Read more
§fn clipboard_text(&self, _clipboard: Clipboard) -> Option<String>
fn clipboard_text(&self, _clipboard: Clipboard) -> Option<String>
Returns a copy of text stored in the system clipboard, if any. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AndroidPlatform
impl !Send for AndroidPlatform
impl !Sync for AndroidPlatform
impl Unpin for AndroidPlatform
impl !UnwindSafe for AndroidPlatform
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more