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

[no changelog]
pull/3949/head
obrusvit 3 weeks ago committed by Vít Obrusník
parent bfedb96071
commit ed624e1cb8

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

@ -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_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(
Frame::left_aligned(

@ -10,7 +10,7 @@ use crate::{
FixedHeightBar,
},
display::{Color, Font},
geometry::Insets,
geometry::{Insets, Offset},
util::include_icon,
},
};
@ -802,6 +802,7 @@ pub const DETAILS_SPACING: i16 = 8;
// checklist settings
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> {
FixedHeightBar::bottom(inner, BUTTON_HEIGHT)

Loading…
Cancel
Save