Skip to content

Commit

Permalink
Align NBGL layout on Stax & Flex Figmas
Browse files Browse the repository at this point in the history
  • Loading branch information
nroggeman-ledger committed Jun 20, 2024
1 parent 1aa3c0a commit bf25025
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
43 changes: 24 additions & 19 deletions lib_nbgl/src/nbgl_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,17 +1749,21 @@ int nbgl_layoutAddHorizontalButtons(nbgl_layout_t *layout
obj->index = 1;
button->obj.alignment = BOTTOM_LEFT;
button->obj.alignmentMarginX = BORDER_MARGIN;
#ifdef TARGET_STAX
button->obj.alignmentMarginY = 20; // 20 pixels from screen bottom
#else // TARGET_STAX
button->obj.alignmentMarginY = 24; // 24 pixels from screen bottom
button->borderColor = LIGHT_GRAY;
button->innerColor = WHITE;
button->foregroundColor = BLACK;
button->obj.area.width = BUTTON_DIAMETER;
button->obj.area.height = BUTTON_DIAMETER;
button->radius = BUTTON_RADIUS;
button->icon = PIC(info->leftIcon);
button->fontId = SMALL_BOLD_FONT;
button->obj.touchMask = (1 << TOUCHED);
button->obj.touchId = CHOICE_2_ID;
#endif // TARGET_STAX
button->borderColor = LIGHT_GRAY;
button->innerColor = WHITE;
button->foregroundColor = BLACK;
button->obj.area.width = BUTTON_DIAMETER;
button->obj.area.height = BUTTON_DIAMETER;
button->radius = BUTTON_RADIUS;
button->icon = PIC(info->leftIcon);
button->fontId = SMALL_BOLD_FONT;
button->obj.touchMask = (1 << TOUCHED);
button->obj.touchId = CHOICE_2_ID;
// set this new button as child of the container
layoutAddObject(layoutInt, (nbgl_obj_t *) button);

Expand Down Expand Up @@ -2494,15 +2498,16 @@ int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *heade
if (obj == NULL) {
return -1;
}
textArea->obj.alignment = MID_RIGHT;
textArea->textColor = BLACK;
textArea->obj.area.width = AVAILABLE_WIDTH;
textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
textArea->text = PIC(headerDesc->rightText.text);
textArea->fontId = SMALL_BOLD_FONT;
textArea->textAlignment = MID_RIGHT;
textArea->obj.touchMask = (1 << TOUCHED);
textArea->obj.touchId = TOP_RIGHT_BUTTON_ID;
textArea->obj.alignment = MID_RIGHT;
textArea->obj.alignmentMarginX = BORDER_MARGIN;
textArea->textColor = BLACK;
textArea->obj.area.width = AVAILABLE_WIDTH;
textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
textArea->text = PIC(headerDesc->rightText.text);
textArea->fontId = SMALL_BOLD_FONT;
textArea->textAlignment = MID_RIGHT;
textArea->obj.touchMask = (1 << TOUCHED);
textArea->obj.touchId = TOP_RIGHT_BUTTON_ID;
// add to bottom container
layoutInt->headerContainer->children[layoutInt->headerContainer->nbChildren]
= (nbgl_obj_t *) textArea;
Expand Down
6 changes: 2 additions & 4 deletions lib_nbgl/src/nbgl_layout_navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ void layoutNavigationPopulate(nbgl_container_t *navContainer,

SPRINTF(navText, "%d of %d", navConfig->activePage + 1, navConfig->nbPages);

textArea->obj.alignment = BOTTOM_RIGHT;
textArea->textColor = DARK_GRAY;
textArea->textColor = DARK_GRAY;
#ifdef TARGET_STAX
textArea->obj.area.width = 109;
#else // TARGET_STAX
Expand All @@ -213,8 +212,7 @@ void layoutNavigationPopulate(nbgl_container_t *navContainer,
textArea->fontId = SMALL_REGULAR_FONT;
textArea->obj.area.height = NAV_BUTTON_HEIGHT;
textArea->textAlignment = CENTER;
textArea->obj.alignment = MID_RIGHT;
textArea->obj.alignmentMarginX = NAV_BUTTON_WIDTH - 15;
textArea->obj.alignment = CENTER;
navContainer->children[PAGE_INDICATOR_INDEX] = (nbgl_obj_t *) textArea;
}
if (navConfig->withBackKey) {
Expand Down
17 changes: 8 additions & 9 deletions lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,8 @@ static void prepareNavInfo(bool isReview, uint8_t nbPages, const char *rejectTex
navInfo.navWithButtons.backButton = true;
}
else {
navInfo.quitToken = REJECT_TOKEN;
UNUSED(rejectText);
navInfo.navWithButtons.quitText = "Reject";
navInfo.quitToken = REJECT_TOKEN;
navInfo.navWithButtons.quitText = rejectText;
navInfo.navWithButtons.navToken = NAV_TOKEN;
navInfo.navWithButtons.backButton
= ((navType == STREAMING_NAV) && (nbPages < 2)) ? false : true;
Expand Down Expand Up @@ -1232,12 +1231,12 @@ static void displaySkipWarning(void)
{
nbgl_pageConfirmationDescription_t info = {
.cancelText = "Go back to review",
.centeredInfo.text1 = "Skip message review?",
.centeredInfo.text1 = "Skip review?",
.centeredInfo.text2
= "Skip only if you trust the\nsource. If you skip, you won't\nbe able to review it again.",
= "If you're sure you don't need to review all fields, you can skip straight to signing.",
.centeredInfo.text3 = NULL,
.centeredInfo.style = LARGE_CASE_INFO,
.centeredInfo.icon = &C_Warning_64px,
.centeredInfo.icon = &C_Important_Circle_64px,
.centeredInfo.offsetY = 0,
.confirmationText = "Yes, skip",
.confirmationToken = SKIP_TOKEN,
Expand Down Expand Up @@ -1557,7 +1556,7 @@ static void bundleNavReviewAskRejectionConfirmation(nbgl_operationType_t operati
}

// display a choice to confirm/cancel rejection
nbgl_useCaseConfirm(title, NULL, "Yes, Reject", confirmText, callback);
nbgl_useCaseConfirm(title, NULL, "Yes, reject", confirmText, callback);
}

static void bundleNavReviewChoice(bool confirm)
Expand Down Expand Up @@ -2889,7 +2888,7 @@ void nbgl_useCaseAddressConfirmationExt(const char *addres
// fill navigation structure, common to all pages
uint8_t nbPages = nbgl_useCaseGetNbPagesForGenericContents(&genericContext.genericContents, 0);

prepareNavInfo(true, nbPages, "Reject");
prepareNavInfo(true, nbPages, "Cancel");

displayGenericContextPage(0, true);
}
Expand Down Expand Up @@ -2944,7 +2943,7 @@ void nbgl_useCaseAddressReview(const char *address,
// fill navigation structure, common to all pages
uint8_t nbPages = nbgl_useCaseGetNbPagesForGenericContents(&genericContext.genericContents, 0);

prepareNavInfo(true, nbPages, "Reject");
prepareNavInfo(true, nbPages, "Cancel");

#ifdef HAVE_PIEZO_SOUND
// Play notification sound
Expand Down

0 comments on commit bf25025

Please sign in to comment.