1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

feat(core): improve the design of TT locking loader on homescreen

[no changelog]
This commit is contained in:
grdddj 2024-01-15 12:47:50 +01:00 committed by Jiří Musil
parent 76c547bb91
commit dba4bf9e38
5 changed files with 29 additions and 4 deletions

BIN
core/assets/lock24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View File

@ -38,7 +38,7 @@ const TOP_CENTER: Point = AREA.top_center();
const LABEL_Y: i16 = HEIGHT - 18; const LABEL_Y: i16 = HEIGHT - 18;
const LOCKED_Y: i16 = HEIGHT / 2 - 13; const LOCKED_Y: i16 = HEIGHT / 2 - 13;
const TAP_Y: i16 = HEIGHT / 2 + 14; const TAP_Y: i16 = HEIGHT / 2 + 14;
const HOLD_Y: i16 = 35; const HOLD_Y: i16 = 200;
const COINJOIN_Y: i16 = 30; const COINJOIN_Y: i16 = 30;
const LOADER_OFFSET: Offset = Offset::y(-10); const LOADER_OFFSET: Offset = Offset::y(-10);
const LOADER_DELAY: Duration = Duration::from_millis(500); const LOADER_DELAY: Duration = Duration::from_millis(500);
@ -67,7 +67,7 @@ where
label, label,
notification, notification,
hold_to_lock, hold_to_lock,
loader: Loader::new().with_durations(LOADER_DURATION, LOADER_DURATION / 3), loader: Loader::with_lock_icon().with_durations(LOADER_DURATION, LOADER_DURATION / 3),
pad: Pad::with_background(theme::BG), pad: Pad::with_background(theme::BG),
paint_notification_only: false, paint_notification_only: false,
delay: None, delay: None,
@ -106,8 +106,8 @@ where
fn paint_loader(&mut self) { fn paint_loader(&mut self) {
display::text_center( display::text_center(
TOP_CENTER + Offset::y(HOLD_Y), TOP_CENTER + Offset::y(HOLD_Y),
"HOLD TO LOCK", "Locking the device...",
Font::BOLD, Font::NORMAL,
theme::FG, theme::FG,
theme::BG, theme::BG,
); );

View File

@ -39,6 +39,15 @@ impl Loader {
pub fn new() -> Self { pub fn new() -> Self {
let styles = theme::loader_default(); let styles = theme::loader_default();
Self::with_styles(styles)
}
pub fn with_lock_icon() -> Self {
let styles = theme::loader_lock_icon();
Self::with_styles(styles)
}
pub fn with_styles(styles: LoaderStyleSheet) -> Self {
Self { Self {
pad: Pad::with_background(styles.normal.background_color), pad: Pad::with_background(styles.normal.background_color),
state: State::Initial, state: State::Initial,

Binary file not shown.

View File

@ -75,6 +75,7 @@ include_icon!(ICON_LIST_CHECK, "model_tt/res/check16.toif");
include_icon!(ICON_WARN, "model_tt/res/warning16.toif"); include_icon!(ICON_WARN, "model_tt/res/warning16.toif");
include_icon!(ICON_WARNING40, "model_tt/res/warning40.toif"); include_icon!(ICON_WARNING40, "model_tt/res/warning40.toif");
include_icon!(ICON_LOCK, "model_tt/res/lock16.toif"); include_icon!(ICON_LOCK, "model_tt/res/lock16.toif");
include_icon!(ICON_LOCK_BIG, "model_tt/res/lock24.toif");
include_icon!(ICON_COINJOIN, "model_tt/res/coinjoin16.toif"); include_icon!(ICON_COINJOIN, "model_tt/res/coinjoin16.toif");
include_icon!(ICON_MAGIC, "model_tt/res/magic.toif"); include_icon!(ICON_MAGIC, "model_tt/res/magic.toif");
@ -575,6 +576,21 @@ pub const fn loader_default() -> LoaderStyleSheet {
} }
} }
pub const fn loader_lock_icon() -> LoaderStyleSheet {
LoaderStyleSheet {
normal: &LoaderStyle {
icon: Some((ICON_LOCK_BIG, FG)),
loader_color: FG,
background_color: BG,
},
active: &LoaderStyle {
icon: Some((ICON_LOCK_BIG, FG)),
loader_color: GREEN,
background_color: BG,
},
}
}
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT); pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(Font::DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT); pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(Font::DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, FG, BG, GREY_LIGHT, GREY_LIGHT); pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);