Skip to content

Commit 5d0cd6c

Browse files
authored
Merge pull request #29 from alephium/improve-ui
Improve UI
2 parents d882e39 + 6e365d2 commit 5d0cd6c

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
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

app/src/ui/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,13 @@ pub fn review_address(pub_key: &ECPublicKey<65, 'W'>) -> Result<(), ErrorCode> {
9595

9696
#[cfg(any(target_os = "stax", target_os = "flex"))]
9797
{
98-
use ledger_device_sdk::nbgl::NbglAddressReview;
98+
use include_gif::include_gif;
99+
use ledger_device_sdk::nbgl::{NbglAddressReview, NbglGlyph};
99100

101+
const APP_ICON: NbglGlyph = NbglGlyph::from_include(include_gif!("alph_64x64.gif", NBGL));
100102
let result = NbglAddressReview::new()
101-
.verify_str("Confirm address")
103+
.glyph(&APP_ICON)
104+
.verify_str("Verify Alephium address")
102105
.show(address_str);
103106
if result {
104107
Ok(())

0 commit comments

Comments
 (0)