ferroui_android/i_ferro_activity.rs
1use crate::i_activity_result_handler::IActivityResultHandler;
2use crate::i_android_navigation_service::IActivityNavigationService;
3use ferroui_base::reactive::IDisposable;
4use ferroui_base::BoxedValue;
5use ferroui_controls::application_lifetimes::ActivatedEventArgs;
6use std::rc::Rc;
7
8/// An activity that shows content of the framework.
9pub trait IFerroActivity: IActivityResultHandler + IActivityNavigationService {
10 /// The content of the view of the activity.
11 fn content(&self) -> Option<BoxedValue>;
12
13 /// Sets the content of the view of the activity.
14 fn set_content(&self, value: Option<BoxedValue>);
15
16 /// Raised when the activity is started or receives an intent.
17 ///
18 /// Disposing the returned value removes the handler.
19 fn activated(&self, handler: Rc<dyn Fn(&ActivatedEventArgs)>) -> Rc<dyn IDisposable>;
20
21 /// Raised when the activity is stopped.
22 ///
23 /// Disposing the returned value removes the handler.
24 fn deactivated(&self, handler: Rc<dyn Fn(&ActivatedEventArgs)>) -> Rc<dyn IDisposable>;
25
26 /// `(activity as Activity)?.MoveTaskToBack(nonRoot)`: moves the task of
27 /// the activity to the back of the activity stack, when the object
28 /// behind the contract is an activity of the system.
29 fn move_task_to_back(&self, _non_root: bool) -> bool {
30 false
31 }
32
33 /// The number of the activity object of this backend, when the object
34 /// behind the contract is one: what tells two activities apart (the
35 /// reference compares the objects).
36 fn as_ferro_activity_handle(&self) -> Option<i64> {
37 None
38 }
39}