Skip to content

Commit 62b26ca

Browse files
committed
chore(core/eckhart): make paginate buttons equally sized
[no changelog]
1 parent 031247b commit 62b26ca

File tree

3 files changed

+91
-80
lines changed

3 files changed

+91
-80
lines changed

core/embed/rust/src/ui/layout_eckhart/firmware/action_bar.rs

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,33 @@ impl ActionBar {
181181
let new_is_last = new_pager.is_last();
182182
let old_is_first = self.pager.is_first();
183183
let new_is_first = new_pager.is_first();
184+
let old_is_single = self.pager.is_single();
185+
let new_is_single = new_pager.is_single();
184186

185187
self.pager = new_pager;
186-
if (old_is_last != new_is_last) || (new_is_first != old_is_first) {
188+
if self.mode == Mode::PaginateOnly {
189+
if new_is_single && !old_is_single {
190+
// On single page, disable first/last buttons
191+
self.left_button = None;
192+
self.right_button = None;
193+
self.place_buttons(self.area);
194+
} else if !new_is_single && old_is_single {
195+
// On multiple pages, enable grayed-out first/last buttons
196+
self.left_button = Some(
197+
Button::with_icon(theme::ICON_CHEVRON_UP)
198+
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
199+
.with_content_offset(Self::BUTTON_CONTENT_OFFSET)
200+
.initially_enabled(false),
201+
);
202+
self.right_button = Some(
203+
Button::with_icon(theme::ICON_CHEVRON_DOWN)
204+
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
205+
.with_content_offset(Self::BUTTON_CONTENT_OFFSET.neg())
206+
.initially_enabled(false),
207+
);
208+
self.place_buttons(self.area);
209+
}
210+
} else if (old_is_last != new_is_last) || (new_is_first != old_is_first) {
187211
self.place_buttons(self.area);
188212
}
189213
}
@@ -334,25 +358,12 @@ impl ActionBar {
334358
self.next_button.place(right_area);
335359
}
336360
Mode::PaginateOnly => {
337-
let (left_area, right_area) = if self.pager.is_first() {
338-
// Only `next_button`
339-
self.next_button.set_content_offset(Offset::zero());
340-
(Rect::zero(), bounds)
341-
} else if self.pager.is_last() {
342-
// Only `prev_button`
343-
self.prev_button.set_content_offset(Offset::zero());
344-
(bounds, Rect::zero())
345-
} else {
346-
// Equal-sized `next_button` and `prev_button`
347-
let (left, _, right) = bounds.split_center(Self::SPACER_WIDTH);
348-
self.prev_button
349-
.set_content_offset(Self::BUTTON_CONTENT_OFFSET);
350-
self.next_button
351-
.set_content_offset(Self::BUTTON_CONTENT_OFFSET.neg());
352-
(left, right)
353-
};
361+
// Equal-sized `next_button` and `prev_button`
362+
let (left_area, _, right_area) = bounds.split_center(Self::SPACER_WIDTH);
354363
self.prev_button.place(left_area);
355364
self.next_button.place(right_area);
365+
self.left_button.place(left_area);
366+
self.right_button.place(right_area);
356367
}
357368
}
358369
}
@@ -467,7 +478,7 @@ impl Component for ActionBar {
467478
Mode::Single => !self.pager.is_first(),
468479
Mode::Double { .. } => true,
469480
Mode::Timeout => false,
470-
Mode::PaginateOnly => !self.pager.is_first() && !self.pager.is_last(),
481+
Mode::PaginateOnly => !self.pager.is_single(),
471482
};
472483
if show_divider {
473484
let pos_divider = self.prev_button.area().right_center();

core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pub const fn button_default() -> ButtonStyleSheet {
195195
font: fonts::FONT_SATOSHI_MEDIUM_26,
196196
text_color: GREY,
197197
button_color: BG,
198-
icon_color: GREY,
198+
icon_color: GREY_EXTRA_DARK,
199199
},
200200
}
201201
}

0 commit comments

Comments
 (0)