diff --git a/core/embed/rust/src/ui/macros.rs b/core/embed/rust/src/ui/macros.rs index 87f637049..8ccea9d9c 100644 --- a/core/embed/rust/src/ui/macros.rs +++ b/core/embed/rust/src/ui/macros.rs @@ -1,10 +1,6 @@ #[allow(unused_macros)] // T1 doesn't use icons (yet) macro_rules! include_res { ($filename:expr) => { - include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../src/trezor/res/", - $filename, - )) + include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/ui/", $filename)) }; } diff --git a/core/embed/rust/src/ui/model_tt/component/page.rs b/core/embed/rust/src/ui/model_tt/component/page.rs index 48cc69cd0..4a862a638 100644 --- a/core/embed/rust/src/ui/model_tt/component/page.rs +++ b/core/embed/rust/src/ui/model_tt/component/page.rs @@ -125,8 +125,13 @@ pub struct ScrollBar { } impl ScrollBar { - pub const DOT_SIZE: Offset = Offset::new(8, 8); - pub const DOT_INTERVAL: i32 = 14; + const DOT_INTERVAL: i32 = 12; + const ARROW_SPACE: i32 = 23; + + const ICON_ACTIVE: &'static [u8] = include_res!("model_tt/res/scroll-active.toif"); + const ICON_INACTIVE: &'static [u8] = include_res!("model_tt/res/scroll-inactive.toif"); + const ICON_UP: &'static [u8] = include_res!("model_tt/res/scroll-up.toif"); + const ICON_DOWN: &'static [u8] = include_res!("model_tt/res/scroll-down.toif"); pub fn vertical_right(area: Rect, page_count: usize, active_page: usize) -> Self { Self { @@ -179,18 +184,30 @@ impl Component for ScrollBar { self.area.center().x, self.area.center().y - (count / 2) * interval, ); - for i in 0..self.page_count { - display::rounded_rect( - Rect::from_center_and_size(dot, Self::DOT_SIZE), - if i == self.active_page { - theme::FG - } else { - theme::GREY_LIGHT - }, + if self.has_previous_page() { + display::icon( + dot - Offset::new(0, Self::ARROW_SPACE), + Self::ICON_UP, + theme::FG, theme::BG, - theme::RADIUS, ); + } + for i in 0..self.page_count { + let icon = if i == self.active_page { + Self::ICON_ACTIVE + } else { + Self::ICON_INACTIVE + }; + display::icon(dot, icon, theme::FG, theme::BG); dot.y += interval; } + if self.has_next_page() { + display::icon( + dot + Offset::new(0, Self::ARROW_SPACE - interval), + Self::ICON_DOWN, + theme::FG, + theme::BG, + ); + } } } diff --git a/core/embed/rust/src/ui/model_tt/res/cancel.toif b/core/embed/rust/src/ui/model_tt/res/cancel.toif new file mode 100644 index 000000000..de600f905 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/cancel.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/confirm.toif b/core/embed/rust/src/ui/model_tt/res/confirm.toif new file mode 100644 index 000000000..e0a3dee8a Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/confirm.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/down.toif b/core/embed/rust/src/ui/model_tt/res/down.toif new file mode 100644 index 000000000..f5dd0e176 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/down.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/next.toif b/core/embed/rust/src/ui/model_tt/res/next.toif new file mode 100644 index 000000000..43684424c Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/next.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/scroll-active.toif b/core/embed/rust/src/ui/model_tt/res/scroll-active.toif new file mode 100644 index 000000000..5373c58c3 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/scroll-active.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/scroll-down.toif b/core/embed/rust/src/ui/model_tt/res/scroll-down.toif new file mode 100644 index 000000000..db06704c7 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/scroll-down.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/scroll-inactive.toif b/core/embed/rust/src/ui/model_tt/res/scroll-inactive.toif new file mode 100644 index 000000000..390f6fa15 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/scroll-inactive.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/scroll-up.toif b/core/embed/rust/src/ui/model_tt/res/scroll-up.toif new file mode 100644 index 000000000..b2c6bb8ab Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/scroll-up.toif differ diff --git a/core/embed/rust/src/ui/model_tt/res/space.toif b/core/embed/rust/src/ui/model_tt/res/space.toif new file mode 100644 index 000000000..bb4106e56 Binary files /dev/null and b/core/embed/rust/src/ui/model_tt/res/space.toif differ diff --git a/core/embed/rust/src/ui/model_tt/theme.rs b/core/embed/rust/src/ui/model_tt/theme.rs index 45e73229c..38f2a1aa9 100644 --- a/core/embed/rust/src/ui/model_tt/theme.rs +++ b/core/embed/rust/src/ui/model_tt/theme.rs @@ -38,9 +38,9 @@ pub const RADIUS: u8 = 4; pub const ICON_SIZE: i32 = 16; // UI icons. -pub const ICON_CANCEL: &[u8] = include_res!("cancel.toif"); -pub const ICON_CONFIRM: &[u8] = include_res!("confirm.toif"); -pub const ICON_SPACE: &[u8] = include_res!("space.toif"); +pub const ICON_CANCEL: &[u8] = include_res!("model_tt/res/cancel.toif"); +pub const ICON_CONFIRM: &[u8] = include_res!("model_tt/res/confirm.toif"); +pub const ICON_SPACE: &[u8] = include_res!("model_tt/res/space.toif"); pub fn label_default() -> LabelStyle { LabelStyle {