mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
dynamic notification dialog and a little cleanup
This commit is contained in:
parent
70575195c3
commit
70f4fe54bd
2 changed files with 39 additions and 4 deletions
BIN
docs/images/modals_dynamic_notification.png
Normal file
BIN
docs/images/modals_dynamic_notification.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
|
|
@ -389,7 +389,7 @@ impl Modals {
|
|||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
|
|
@ -428,7 +428,7 @@ impl Modals {
|
|||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
|
|
@ -616,7 +616,7 @@ impl Modals {
|
|||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
|
|
@ -692,7 +692,7 @@ impl Modals {
|
|||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
|
|
@ -789,6 +789,37 @@ impl Modals {
|
|||
}
|
||||
}
|
||||
|
||||
/// Notification modal with title and text that can be updated.
|
||||
/// - Modal cannot be dismissed by the user, you must close this dialog using `dynamic_notification_close`
|
||||
/// - Burden is on the consumer to not exceed available space.
|
||||
///
|
||||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use modals::Modals;
|
||||
/// use xous_names::XousNames;
|
||||
/// let xns = XousNames::new().unwrap();
|
||||
/// let modals = Modals::new(&xns).unwrap();
|
||||
///
|
||||
/// modals
|
||||
/// .dynamic_notification(Some("TITLE OF NOTIFICATION"), Some("Important details go here..."))
|
||||
/// .unwrap();
|
||||
/// /// do some stuff
|
||||
/// modals
|
||||
/// .dynamic_notification_update(
|
||||
/// Some("Important update!"),
|
||||
/// Some("We're almost there, please hold.."),
|
||||
/// )
|
||||
/// .unwrap();
|
||||
/// /// do more stuff
|
||||
/// modals.dynamic_notification_close().unwrap();
|
||||
/// ```
|
||||
pub fn dynamic_notification(&self, title: Option<&str>, text: Option<&str>) -> Result<(), xous::Error> {
|
||||
self.lock();
|
||||
let spec = DynamicNotification {
|
||||
|
|
@ -802,6 +833,8 @@ impl Modals {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// - Calling this to update the dynamic_notification dialog is optional.
|
||||
/// - See documentation for `dynamic_notification` for a code example.
|
||||
pub fn dynamic_notification_update(
|
||||
&self,
|
||||
title: Option<&str>,
|
||||
|
|
@ -818,6 +851,8 @@ impl Modals {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// - You must call this method to dismiss `dynamic_notification` when it is no longer needed.
|
||||
/// - See documentation for `dynamic_notification` for a code example.
|
||||
pub fn dynamic_notification_close(&self) -> Result<(), xous::Error> {
|
||||
send_message(
|
||||
self.conn,
|
||||
|
|
|
|||
Loading…
Reference in a new issue