@@ -3017,21 +3017,25 @@ uint8_t nbgl_useCaseGetNbSwitchesInPage(uint8_t nbSwit
3017
3017
{
3018
3018
uint8_t nbSwitchesInPage = 0 ;
3019
3019
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 );
3023
3023
3024
3024
while (nbSwitchesInPage < nbSwitches ) {
3025
3025
// 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
+ }
3035
3039
// if height is over the limit
3036
3040
if (currentHeight >= (INFOS_AREA_HEIGHT - navHeight )) {
3037
3041
break ;
0 commit comments