Skip to content

Commit 6e365d2

Browse files
committed
Improve the main page for ledger nano
1 parent 2c130cb commit 6e365d2

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

app/src/ui/display.rs

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
use include_gif::include_gif;
12
use ledger_device_sdk::io;
23
use ledger_device_sdk::ui::{
3-
bagls, gadgets,
4-
layout::{self, Draw, StringPlace},
4+
bagls,
5+
bitmaps::{Glyph, DASHBOARD_X},
6+
gadgets,
7+
layout::Draw,
58
screen_util,
69
};
710
use ledger_secure_sdk_sys::buttons::ButtonEvent;
@@ -26,47 +29,32 @@ fn show_ui_common(draw: fn() -> ()) {
2629

2730
fn show_ui_welcome() {
2831
show_ui_common(|| {
29-
let mut lines = [
30-
bagls::Label::from_const("Alephium"),
31-
bagls::Label::from_const("ready"),
32-
];
33-
lines[0].bold = true;
34-
lines.place(layout::Location::Middle, layout::Layout::Centered, false);
32+
const APP_ICON: Glyph = Glyph::from_include(include_gif!("alph_14x14.gif"));
33+
gadgets::Page::from((["Alephium ", "is ready"], &APP_ICON)).place();
3534
});
3635
}
3736

3837
fn show_ui_blind_signing() {
3938
show_ui_common(|| {
40-
let mut lines = [
41-
bagls::Label::from_const("Blind Signing"),
42-
bagls::Label::from_const(if is_blind_signing_enabled() {
43-
"enabled"
44-
} else {
45-
"disabled"
46-
}),
47-
];
48-
lines[0].bold = true;
49-
lines.place(layout::Location::Middle, layout::Layout::Centered, false);
39+
let label = if is_blind_signing_enabled() {
40+
"enabled"
41+
} else {
42+
"disabled"
43+
};
44+
gadgets::Page::from((["Blind Signing", label], false)).place();
5045
});
5146
}
5247

5348
fn show_ui_version() {
5449
show_ui_common(|| {
5550
const VERSION: &str = env!("CARGO_PKG_VERSION");
56-
let mut lines = [
57-
bagls::Label::from_const("Version"),
58-
bagls::Label::from_const(VERSION),
59-
];
60-
lines[0].bold = true;
61-
lines.place(layout::Location::Middle, layout::Layout::Centered, false);
51+
gadgets::Page::from((["Version", VERSION], false)).place();
6252
});
6353
}
6454

6555
fn show_ui_quit() {
6656
show_ui_common(|| {
67-
let mut lines = [bagls::Label::from_const("Quit")];
68-
lines[0].bold = true;
69-
lines.place(layout::Location::Middle, layout::Layout::Centered, false);
57+
gadgets::Page::from(("Quit", &DASHBOARD_X)).place();
7058
});
7159
}
7260

0 commit comments

Comments
 (0)