@@ -52,20 +52,26 @@ enum {
52
52
#define BOTTOM_COMPACT_MARGIN 24
53
53
#define TOP_NORMAL_MARGIN 20
54
54
#define TOP_COMPACT_MARGIN 20
55
+ #define TITLE_ENTRY_MARGIN_Y 4
56
+ #define TEXT_ENTRY_FONT LARGE_MEDIUM_1BPP_FONT
55
57
#elif defined(TARGET_FLEX )
56
58
#define TEXT_ENTRY_NORMAL_HEIGHT 72
57
59
#define TEXT_ENTRY_COMPACT_HEIGHT 56
58
60
#define BOTTOM_NORMAL_MARGIN 24
59
61
#define BOTTOM_COMPACT_MARGIN 12
60
62
#define TOP_NORMAL_MARGIN 20
61
63
#define TOP_COMPACT_MARGIN 12
64
+ #define TITLE_ENTRY_MARGIN_Y 4
65
+ #define TEXT_ENTRY_FONT LARGE_MEDIUM_1BPP_FONT
62
66
#elif defined(TARGET_APEX )
63
- #define TEXT_ENTRY_NORMAL_HEIGHT 64
64
- #define TEXT_ENTRY_COMPACT_HEIGHT 64
65
- #define BOTTOM_NORMAL_MARGIN 24
66
- #define BOTTOM_COMPACT_MARGIN 24
67
- #define TOP_NORMAL_MARGIN 20
67
+ #define TEXT_ENTRY_NORMAL_HEIGHT 40
68
+ #define TEXT_ENTRY_COMPACT_HEIGHT 40
69
+ #define BOTTOM_NORMAL_MARGIN 16
70
+ #define BOTTOM_COMPACT_MARGIN 20
71
+ #define TOP_NORMAL_MARGIN 12
68
72
#define TOP_COMPACT_MARGIN 20
73
+ #define TITLE_ENTRY_MARGIN_Y 0
74
+ #define TEXT_ENTRY_FONT SMALL_BOLD_FONT
69
75
#endif // TARGETS
70
76
71
77
#ifdef USE_PARTIAL_BUTTONS
@@ -289,7 +295,7 @@ static nbgl_container_t *addTextEntry(nbgl_layoutInternal_t *layoutInt,
289
295
textArea -> obj .area .height = nbgl_getTextHeightInWidth (
290
296
textArea -> fontId , textArea -> text , textArea -> obj .area .width , textArea -> wrapping );
291
297
mainContainer -> children [0 ] = (nbgl_obj_t * ) textArea ;
292
- mainContainer -> obj .area .height = textArea -> obj .area .height + 4 ;
298
+ mainContainer -> obj .area .height = textArea -> obj .area .height + TITLE_ENTRY_MARGIN_Y ;
293
299
}
294
300
295
301
// create a text-entry container number, entered text and underline
@@ -306,10 +312,10 @@ static nbgl_container_t *addTextEntry(nbgl_layoutInternal_t *layoutInt,
306
312
snprintf (numText , sizeof (numText ), "%d." , number );
307
313
textArea -> text = numText ;
308
314
textArea -> textAlignment = CENTER ;
309
- textArea -> fontId = LARGE_MEDIUM_1BPP_FONT ;
315
+ textArea -> fontId = TEXT_ENTRY_FONT ;
310
316
textArea -> obj .area .width = NUMBER_WIDTH ;
311
317
textArea -> obj .alignment = MID_LEFT ;
312
- textArea -> obj .area .height = nbgl_getFontHeight (LARGE_MEDIUM_1BPP_FONT );
318
+ textArea -> obj .area .height = nbgl_getFontHeight (textArea -> fontId );
313
319
// set this text area as child of the container
314
320
container -> children [0 ] = (nbgl_obj_t * ) textArea ;
315
321
}
@@ -319,7 +325,7 @@ static nbgl_container_t *addTextEntry(nbgl_layoutInternal_t *layoutInt,
319
325
textArea -> textColor = grayedOut ? INACTIVE_TEXT_COLOR : BLACK ;
320
326
textArea -> text = text ;
321
327
textArea -> textAlignment = MID_LEFT ;
322
- textArea -> fontId = LARGE_MEDIUM_1BPP_FONT ;
328
+ textArea -> fontId = TEXT_ENTRY_FONT ;
323
329
textArea -> obj .area .width = AVAILABLE_WIDTH ;
324
330
if (numbered ) {
325
331
textArea -> obj .alignmentMarginX = NUMBER_TEXT_SPACE ;
@@ -330,7 +336,7 @@ static nbgl_container_t *addTextEntry(nbgl_layoutInternal_t *layoutInt,
330
336
else {
331
337
textArea -> obj .alignment = MID_LEFT ;
332
338
}
333
- textArea -> obj .area .height = nbgl_getFontHeight (LARGE_MEDIUM_1BPP_FONT );
339
+ textArea -> obj .area .height = nbgl_getFontHeight (textArea -> fontId );
334
340
textArea -> autoHideLongLine = true;
335
341
336
342
obj = layoutAddCallbackObj (layoutInt , (nbgl_obj_t * ) textArea , textToken , NBGL_NO_TUNE );
@@ -386,7 +392,7 @@ static nbgl_container_t *addSuggestionButtons(nbgl_layoutInternal_t *layoutInt,
386
392
suggestionsContainer -> children
387
393
= (nbgl_obj_t * * ) nbgl_containerPoolGet (NB_SUGGESTION_CHILDREN , layoutInt -> layer );
388
394
389
- // put suggestionsContainer at 24px of the bottom of main container
395
+ // put suggestionsContainer at the bottom of main container
390
396
suggestionsContainer -> obj .alignmentMarginY
391
397
= compactMode ? BOTTOM_COMPACT_MARGIN : BOTTOM_NORMAL_MARGIN ;
392
398
suggestionsContainer -> obj .alignment = BOTTOM_MIDDLE ;
@@ -463,7 +469,7 @@ static nbgl_button_t *addConfirmationButton(nbgl_layoutInternal_t *layoutInt,
463
469
return NULL ;
464
470
}
465
471
466
- // put button at 24px/12px of the keyboard
472
+ // put button at the bottom of the main container
467
473
button -> obj .alignmentMarginY = compactMode ? BOTTOM_COMPACT_MARGIN : BOTTOM_NORMAL_MARGIN ;
468
474
button -> obj .alignment = BOTTOM_MIDDLE ;
469
475
button -> foregroundColor = WHITE ;
@@ -627,60 +633,6 @@ bool nbgl_layoutKeyboardNeedsRefresh(nbgl_layout_t *layout, uint8_t index)
627
633
return false;
628
634
}
629
635
630
- /**
631
- * @brief Adds up to 4 black suggestion buttons under the previously added object
632
- * @deprecated Use @ref nbgl_layoutAddKeyboardContent instead
633
- *
634
- * @param layout the current layout
635
- * @param nbUsedButtons the number of actually used buttons
636
- * @param buttonTexts array of 4 strings for buttons (last ones can be NULL)
637
- * @param firstButtonToken first token used for buttons, provided in onActionCallback (the next 3
638
- * values will be used for other buttons)
639
- * @param tuneId tune to play when any button is pressed
640
- * @return >= 0 if OK
641
- */
642
- int nbgl_layoutAddSuggestionButtons (nbgl_layout_t * layout ,
643
- uint8_t nbUsedButtons ,
644
- const char * buttonTexts [NB_MAX_SUGGESTION_BUTTONS ],
645
- int firstButtonToken ,
646
- tune_index_e tuneId )
647
- {
648
- nbgl_container_t * container ;
649
- nbgl_layoutInternal_t * layoutInt = (nbgl_layoutInternal_t * ) layout ;
650
- // if a centered info has be used for title, entered text is the second child
651
- uint8_t enteredTextIndex = (layoutInt -> container -> nbChildren == 2 ) ? 0 : 1 ;
652
-
653
- LOG_DEBUG (LAYOUT_LOGGER , "nbgl_layoutAddSuggestionButtons():\n" );
654
- if (layout == NULL ) {
655
- return -1 ;
656
- }
657
-
658
- container = addSuggestionButtons (
659
- layoutInt , nbUsedButtons , buttonTexts , firstButtonToken , tuneId , false);
660
- // set this container as 2nd or 3rd child of the main layout container
661
- layoutInt -> container -> children [enteredTextIndex + 1 ] = (nbgl_obj_t * ) container ;
662
- if (layoutInt -> container -> children [enteredTextIndex ] != NULL ) {
663
- ((nbgl_container_t * ) layoutInt -> container -> children [enteredTextIndex ])
664
- -> obj .alignmentMarginY
665
- -= (container -> obj .area .height + container -> obj .alignmentMarginY + 20 ) / 2 ;
666
- }
667
- #ifdef USE_PARTIAL_BUTTONS
668
- // the main container is swipable on Flex
669
- if (layoutAddCallbackObj (layoutInt , (nbgl_obj_t * ) layoutInt -> container , 0 , NBGL_NO_TUNE )
670
- == NULL ) {
671
- return -1 ;
672
- }
673
- layoutInt -> container -> obj .touchMask = (1 << SWIPED_LEFT ) | (1 << SWIPED_RIGHT );
674
- layoutInt -> container -> obj .touchId = CONTROLS_ID ;
675
- layoutInt -> swipeUsage = SWIPE_USAGE_SUGGESTIONS ;
676
- #endif // USE_PARTIAL_BUTTONS
677
- // set this new container as child of the main container
678
- layoutAddObject (layoutInt , (nbgl_obj_t * ) container );
679
-
680
- // return index of container to be modified later on
681
- return (layoutInt -> container -> nbChildren - 1 );
682
- }
683
-
684
636
/**
685
637
* @brief Updates the number and/or the text suggestion buttons created with @ref
686
638
* nbgl_layoutAddSuggestionButtons()
0 commit comments