From e40084ef9fdae4c4a6b1d88c3537a76feb2d9f29 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Wed, 8 Jan 2025 12:48:16 +0100 Subject: [PATCH] feat(eckhart): action bar component --- .../rust/src/ui/layout_bolt/component/page.rs | 22 +- .../ui/layout_eckhart/component/action_bar.rs | 260 ++++++++++++++++++ .../src/ui/layout_eckhart/component/button.rs | 11 +- .../src/ui/layout_eckhart/component/mod.rs | 2 + 4 files changed, 279 insertions(+), 16 deletions(-) create mode 100644 core/embed/rust/src/ui/layout_eckhart/component/action_bar.rs diff --git a/core/embed/rust/src/ui/layout_bolt/component/page.rs b/core/embed/rust/src/ui/layout_bolt/component/page.rs index b656337f5a..9b16032ba6 100644 --- a/core/embed/rust/src/ui/layout_bolt/component/page.rs +++ b/core/embed/rust/src/ui/layout_bolt/component/page.rs @@ -46,20 +46,6 @@ pub struct ButtonPage { fade: Cell>, } -impl ButtonPage -where - T: Paginate, - T: Component, -{ - pub fn with_hold(mut self) -> Result { - self.button_confirm = Button::with_text(TR::buttons__hold_to_confirm.into()) - .styled(theme::button_confirm()) - .without_haptics(); - self.loader = Some(Loader::new()); - Ok(self) - } -} - impl ButtonPage where T: Paginate, @@ -122,6 +108,14 @@ where self } + pub fn with_hold(mut self) -> Result { + self.button_confirm = Button::with_text(TR::buttons__hold_to_confirm.into()) + .styled(theme::button_confirm()) + .without_haptics(); + self.loader = Some(Loader::new()); + Ok(self) + } + pub fn with_confirm_style(mut self, style: ButtonStyleSheet) -> Self { self.button_confirm = self.button_confirm.styled(style); self diff --git a/core/embed/rust/src/ui/layout_eckhart/component/action_bar.rs b/core/embed/rust/src/ui/layout_eckhart/component/action_bar.rs new file mode 100644 index 0000000000..9909c5f567 --- /dev/null +++ b/core/embed/rust/src/ui/layout_eckhart/component/action_bar.rs @@ -0,0 +1,260 @@ +use crate::ui::{ + component::{Component, Event, EventCtx}, + geometry::{Alignment2D, Offset, Rect}, + shape::{self, Renderer}, + util::Pager, +}; + +use super::{ + button::{Button, ButtonContent, ButtonMsg}, + theme, ButtonStyleSheet, +}; + +/// Component for control buttons in the bottom of the screen. +pub struct ActionBar { + /// Behavior based on `Mode` + mode: Mode, + /// Right or single button, can have text or icon + right_button: Button, + /// Optional left button, can be shorter than the right one + left_button: Option