Skip to content

Commit b9f88d6

Browse files
Merge pull request #1100 from LedgerHQ/auto_update_API_LEVEL_25
[AUTO_UPDATE] Branch API_LEVEL_25
2 parents 048c879 + 4534b3f commit b9f88d6

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lib_nbgl/src/nbgl_use_case.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,21 +3017,25 @@ uint8_t nbgl_useCaseGetNbSwitchesInPage(uint8_t nbSwit
30173017
{
30183018
uint8_t nbSwitchesInPage = 0;
30193019
uint16_t currentHeight = 0;
3020-
uint16_t previousHeight;
3021-
uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
3022-
nbgl_contentSwitch_t *switchArray = (nbgl_contentSwitch_t *) PIC(switchesList->switches);
3020+
uint16_t previousHeight = 0;
3021+
uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
3022+
nbgl_contentSwitch_t *switchArray = (nbgl_contentSwitch_t *) PIC(switchesList->switches);
30233023

30243024
while (nbSwitchesInPage < nbSwitches) {
30253025
// The text string must be a 1 liner and its height is LIST_ITEM_MIN_TEXT_HEIGHT
3026-
currentHeight
3027-
+= LIST_ITEM_MIN_TEXT_HEIGHT + 2 * LIST_ITEM_PRE_HEADING + LIST_ITEM_HEADING_SUB_TEXT;
3028-
3029-
// sub-text height
3030-
currentHeight
3031-
+= nbgl_getTextHeightInWidth(SMALL_REGULAR_FONT,
3032-
switchArray[startIndex + nbSwitchesInPage].subText,
3033-
AVAILABLE_WIDTH,
3034-
true);
3026+
currentHeight += LIST_ITEM_MIN_TEXT_HEIGHT + LIST_ITEM_PRE_HEADING;
3027+
3028+
if (switchArray[startIndex + nbSwitchesInPage].subText) {
3029+
currentHeight += LIST_ITEM_HEADING_SUB_TEXT;
3030+
3031+
// sub-text height
3032+
currentHeight
3033+
+= nbgl_getTextHeightInWidth(SMALL_REGULAR_FONT,
3034+
switchArray[startIndex + nbSwitchesInPage].subText,
3035+
AVAILABLE_WIDTH,
3036+
true);
3037+
currentHeight += LIST_ITEM_PRE_HEADING; // under the sub-text
3038+
}
30353039
// if height is over the limit
30363040
if (currentHeight >= (INFOS_AREA_HEIGHT - navHeight)) {
30373041
break;

0 commit comments

Comments
 (0)