Skip to content

Commit 9a4539e

Browse files
committed
ui: break out printing full-screen messages from splash() into generic function
Signed-off-by: Leonard Göhrs <[email protected]>
1 parent f2e8277 commit 9a4539e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ui/screens.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,21 @@ const fn row_anchor(row_num: u8) -> Point {
166166
Point::new(8, 52 + (row_num as i32) * 20)
167167
}
168168

169-
pub(super) fn splash(target: &mut DisplayExclusive) -> Rectangle {
169+
pub fn message(target: &mut DisplayExclusive, text: &str) -> Rectangle {
170170
let ui_text_style: MonoTextStyle<BinaryColor> =
171171
MonoTextStyle::new(&UI_TEXT_FONT, BinaryColor::On);
172172

173-
let text = Text::with_alignment(
174-
"Welcome",
175-
Point::new(120, 120),
176-
ui_text_style,
177-
Alignment::Center,
178-
);
173+
let text = Text::with_alignment(text, Point::new(120, 120), ui_text_style, Alignment::Center);
179174

180175
text.draw(target).unwrap();
181176

182177
text.bounding_box()
183178
}
184179

180+
pub fn splash(target: &mut DisplayExclusive) -> Rectangle {
181+
message(target, "Welcome")
182+
}
183+
185184
pub(super) fn init(
186185
res: &UiResources,
187186
alerts: &Arc<Topic<AlertList>>,

0 commit comments

Comments
 (0)