1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-19 12:58:13 +00:00

feat(core/ui): use numerals in T3T1 checklist

[no changelog]
This commit is contained in:
obrusvit 2024-06-18 15:41:20 +02:00 committed by Vít Obrusník
parent bfedb96071
commit ed624e1cb8
3 changed files with 9 additions and 6 deletions

View File

@ -611,8 +611,8 @@ where
self self
} }
pub fn with_numerals(mut self, show_numerals: bool) -> Self { pub fn with_numerals(mut self) -> Self {
self.show_numerals = show_numerals; self.show_numerals = true;
self self
} }
@ -628,7 +628,7 @@ where
} else { } else {
// current and future tasks - ordinal numbers or icon on current task // current and future tasks - ordinal numbers or icon on current task
if self.show_numerals { if self.show_numerals {
let num_offset = Offset::y(Font::NORMAL.visible_text_height("1")); let num_offset = Offset::new(4, Font::NORMAL.visible_text_height("1"));
self.render_numeral(base + num_offset, i, l.style.text_color, target); self.render_numeral(base + num_offset, i, l.style.text_color, target);
} else if i == current_visible { } else if i == current_visible {
let color = l.style.text_color; let color = l.style.text_color;
@ -657,7 +657,7 @@ where
) { ) {
let numeral = uformat!("{}.", n + 1); let numeral = uformat!("{}.", n + 1);
shape::Text::new(base_point, numeral.as_str()) shape::Text::new(base_point, numeral.as_str())
.with_font(Font::NORMAL) .with_font(Font::SUB)
.with_fg(color) .with_fg(color)
.render(target); .render(target);
} }

View File

@ -1063,7 +1063,9 @@ extern "C" fn new_show_checklist(n_args: usize, args: *const Obj, kwargs: *mut M
.with_spacing(theme::CHECKLIST_SPACING), .with_spacing(theme::CHECKLIST_SPACING),
) )
.with_check_width(theme::CHECKLIST_CHECK_WIDTH) .with_check_width(theme::CHECKLIST_CHECK_WIDTH)
.with_icon_done_color(theme::GREEN); .with_numerals()
.with_icon_done_color(theme::GREEN)
.with_done_offset(theme::CHECKLIST_DONE_OFFSET);
let obj = LayoutObj::new(SwipeUpScreen::new( let obj = LayoutObj::new(SwipeUpScreen::new(
Frame::left_aligned( Frame::left_aligned(

View File

@ -10,7 +10,7 @@ use crate::{
FixedHeightBar, FixedHeightBar,
}, },
display::{Color, Font}, display::{Color, Font},
geometry::Insets, geometry::{Insets, Offset},
util::include_icon, util::include_icon,
}, },
}; };
@ -802,6 +802,7 @@ pub const DETAILS_SPACING: i16 = 8;
// checklist settings // checklist settings
pub const CHECKLIST_CHECK_WIDTH: i16 = 32; // icon width (20px) + padding (12px) pub const CHECKLIST_CHECK_WIDTH: i16 = 32; // icon width (20px) + padding (12px)
pub const CHECKLIST_DONE_OFFSET: Offset = Offset::y(-2);
pub const fn button_bar<T>(inner: T) -> FixedHeightBar<T> { pub const fn button_bar<T>(inner: T) -> FixedHeightBar<T> {
FixedHeightBar::bottom(inner, BUTTON_HEIGHT) FixedHeightBar::bottom(inner, BUTTON_HEIGHT)