mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-19 14:08:11 +00:00
fix(core): fix lockscreen Not connected label hiding
[no changelog]
This commit is contained in:
parent
106edd4309
commit
23d31cc8b3
@ -481,6 +481,7 @@ impl LockscreenAnim {
|
|||||||
pub struct Lockscreen {
|
pub struct Lockscreen {
|
||||||
anim: LockscreenAnim,
|
anim: LockscreenAnim,
|
||||||
label: Label<'static>,
|
label: Label<'static>,
|
||||||
|
name_width: i16,
|
||||||
label_width: i16,
|
label_width: i16,
|
||||||
label_height: i16,
|
label_height: i16,
|
||||||
image: Option<BinaryData<'static>>,
|
image: Option<BinaryData<'static>>,
|
||||||
@ -503,12 +504,22 @@ impl Lockscreen {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let label_width = label.map(|t| theme::TEXT_DEMIBOLD.text_font.text_width(t));
|
let name_width = label.map(|t| theme::TEXT_DEMIBOLD.text_font.text_width(t));
|
||||||
|
|
||||||
|
let label_width = if bootscreen {
|
||||||
|
let min = TR::lockscreen__title_not_connected
|
||||||
|
.map_translated(|t| theme::TEXT_SUB_GREY.text_font.text_width(t));
|
||||||
|
name_width.max(min)
|
||||||
|
} else {
|
||||||
|
name_width
|
||||||
|
};
|
||||||
|
|
||||||
let label_height = label.map(|t| theme::TEXT_DEMIBOLD.text_font.visible_text_height(t));
|
let label_height = label.map(|t| theme::TEXT_DEMIBOLD.text_font.visible_text_height(t));
|
||||||
|
|
||||||
Lockscreen {
|
Lockscreen {
|
||||||
anim: LockscreenAnim::default(),
|
anim: LockscreenAnim::default(),
|
||||||
label: Label::new(label, Alignment::Center, theme::TEXT_DEMIBOLD),
|
label: Label::new(label, Alignment::Center, theme::TEXT_DEMIBOLD),
|
||||||
|
name_width,
|
||||||
label_width,
|
label_width,
|
||||||
label_height,
|
label_height,
|
||||||
image,
|
image,
|
||||||
@ -525,7 +536,7 @@ impl Component for Lockscreen {
|
|||||||
|
|
||||||
fn place(&mut self, bounds: Rect) -> Rect {
|
fn place(&mut self, bounds: Rect) -> Rect {
|
||||||
self.label
|
self.label
|
||||||
.place(bounds.split_top(38).0.with_width(self.label_width + 12));
|
.place(bounds.split_top(38).0.with_width(self.name_width + 12));
|
||||||
bounds
|
bounds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user