1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-19 00:29:03 +00:00

fix(core/ui): use "..." ellipsis in "show more"

This commit is contained in:
Ioan Bizău 2025-03-05 11:01:21 +01:00 committed by Ioan Bizău
parent 828e1868ab
commit 40756a0941
9 changed files with 469 additions and 436 deletions

View File

@ -0,0 +1 @@
Replaced "next page" icon with "..." ellipsis when confirming long message.

View File

@ -607,6 +607,11 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_L
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
/// Makes sure that the displayed text (usually address) will get divided into
/// smaller chunks.
pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO

View File

@ -476,7 +476,7 @@ impl FirmwareUI for UIBolt {
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
let is_data = is_data.try_into()?;
let style: &TextStyle = if is_data {
&theme::TEXT_MONO
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_NORMAL
};

View File

@ -42,9 +42,15 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, FG, FG
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, FG, BG, FG, FG)
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
/// Mono data text does not have hyphens
pub const TEXT_MONO_DATA: TextStyle =
TEXT_MONO.with_line_breaking(LineBreaking::BreakWordsNoHyphen);
pub const TEXT_MONO_DATA_WITH_CLASSIC_ELLIPSIS: TextStyle =
TEXT_MONO_WITH_CLASSIC_ELLIPSIS.with_line_breaking(LineBreaking::BreakWordsNoHyphen);
pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_DATA
.with_chunks(MONO_CHUNKS)
.with_line_spacing(2)

View File

@ -615,7 +615,7 @@ impl FirmwareUI for UICaesar {
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
let is_data = is_data.try_into()?;
let style: &TextStyle = if is_data {
&theme::TEXT_MONO_DATA
&theme::TEXT_MONO_DATA_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_NORMAL
};

View File

@ -49,6 +49,7 @@ pub struct ConfirmValue {
text_mono: bool,
page_counter: bool,
page_limit: Option<u16>,
classic_ellipsis: bool,
swipe_up: bool,
swipe_down: bool,
swipe_right: bool,
@ -79,6 +80,7 @@ impl ConfirmValue {
text_mono: true,
page_counter: false,
page_limit: None,
classic_ellipsis: false,
swipe_up: false,
swipe_down: false,
swipe_right: false,
@ -208,6 +210,11 @@ impl ConfirmValue {
self
}
pub const fn with_classic_ellipsis(mut self, classic_ellipsis: bool) -> Self {
self.classic_ellipsis = classic_ellipsis;
self
}
pub const fn with_description_font(mut self, description_font: &'static TextStyle) -> Self {
self.description_font = description_font;
self
@ -228,7 +235,11 @@ impl ConfirmValue {
let value: TString = self.value.try_into()?;
theme::get_chunkified_text_style(value.len())
} else if self.text_mono {
&theme::TEXT_MONO
if self.classic_ellipsis {
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_MONO
}
} else {
&theme::TEXT_NORMAL
},
@ -279,7 +290,11 @@ impl ConfirmValue {
let value: TString = self.value.try_into()?;
theme::get_chunkified_text_style(value.len())
} else if self.text_mono {
&theme::TEXT_MONO
if self.classic_ellipsis {
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_MONO
}
} else {
&theme::TEXT_NORMAL
},

View File

@ -741,6 +741,11 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIG
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_GREY_LIGHT: TextStyle = TextStyle {
text_color: GREY_LIGHT,
..TEXT_MONO

View File

@ -142,6 +142,7 @@ impl FirmwareUI for UIDelizia {
.with_footer_description(verb)
.with_chunkify(chunkify)
.with_page_limit(Some(1))
.with_classic_ellipsis(true)
.with_frame_margin(CONFIRM_VALUE_INTRO_MARGIN)
.with_hold(hold)
.into_flow()

File diff suppressed because it is too large Load Diff