Skip to content

Commit 93a1075

Browse files
committed
feat: add show_from function on multipage menu
1 parent 51178d1 commit 93a1075

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ledger_device_sdk/src/ui/gadgets.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,19 +554,26 @@ impl<'a> MultiPageMenu<'a> {
554554
}
555555

556556
pub fn show<T: TryFrom<ApduHeader>>(&mut self) -> EventOrPageIndex<T>
557+
where
558+
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
559+
{
560+
self.show_from(0)
561+
}
562+
563+
pub fn show_from<T: TryFrom<ApduHeader>>(&mut self, page_index: usize) -> EventOrPageIndex<T>
557564
where
558565
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
559566
{
560567
clear_screen();
561568

562-
self.pages[0].place();
569+
self.pages[page_index].place();
563570

564571
LEFT_ARROW.display();
565572
RIGHT_ARROW.display();
566573

567574
crate::ui::screen_util::screen_update();
568575

569-
let mut index = 0;
576+
let mut index = page_index;
570577

571578
loop {
572579
match self.comm.next_event() {

0 commit comments

Comments
 (0)