diff --git a/lib_nbgl/include/nbgl_layout.h b/lib_nbgl/include/nbgl_layout.h index e7d797d5d..d1c17f497 100644 --- a/lib_nbgl/include/nbgl_layout.h +++ b/lib_nbgl/include/nbgl_layout.h @@ -617,7 +617,7 @@ int nbgl_layoutAddChoiceButtons(nbgl_layout_t *layout, const nbgl_layoutChoiceBu int nbgl_layoutAddHorizontalButtons(nbgl_layout_t *layout, const nbgl_layoutHorizontalButtons_t *info); int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list); -int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text); +int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut); int nbgl_layoutAddTextContent(nbgl_layout_t *layout, const char *title, const char *description, diff --git a/lib_nbgl/src/nbgl_layout.c b/lib_nbgl/src/nbgl_layout.c index 37b5882a4..4ce8504fb 100644 --- a/lib_nbgl/src/nbgl_layout.c +++ b/lib_nbgl/src/nbgl_layout.c @@ -1366,13 +1366,14 @@ int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text) } /** - * @brief Creates an area with given text in 32px font (in Black) + * @brief Creates an area with given text in 32px font (in Black or Light Gray) * * @param layout the current layout * @param text text to be displayed (auto-wrap) + * @param grayedOut if true, use light-gray instead of black * @return >= 0 if OK */ -int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text) +int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut) { nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout; nbgl_text_area_t *textArea; @@ -1383,7 +1384,7 @@ int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text) } textArea = (nbgl_text_area_t *) nbgl_objPoolGet(TEXT_AREA, layoutInt->layer); - textArea->textColor = BLACK; + textArea->textColor = grayedOut ? LIGHT_GRAY : BLACK; textArea->text = PIC(text); textArea->textAlignment = MID_LEFT; textArea->fontId = LARGE_MEDIUM_FONT; @@ -1394,12 +1395,19 @@ int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text) textArea->style = NO_STYLE; textArea->obj.alignment = NO_ALIGNMENT; textArea->obj.alignmentMarginX = BORDER_MARGIN; -#ifdef TARGET_STAX - // if first object of container, increase the margin from top if (layoutInt->container->nbChildren == 0) { +#ifdef TARGET_STAX + // if first object of container, increase the margin from top textArea->obj.alignmentMarginY += BORDER_MARGIN; - } #endif // TARGET_STAX + } + else { +#ifdef TARGET_STAX + textArea->obj.alignmentMarginY = 40; // 40px between paragraphs +#else // TARGET_STAX + textArea->obj.alignmentMarginY = 24; // 24px between paragraphs +#endif // TARGET_STAX + } // set this new obj as child of main container layoutAddObject(layoutInt, (nbgl_obj_t *) textArea); diff --git a/lib_nbgl/src/nbgl_touch.c b/lib_nbgl/src/nbgl_touch.c index 1e6881f8d..973b02d11 100644 --- a/lib_nbgl/src/nbgl_touch.c +++ b/lib_nbgl/src/nbgl_touch.c @@ -308,6 +308,7 @@ void nbgl_touchHandler(nbgl_touchStatePosition_t *touchStatePosition, uint32_t c nbgl_touchType_t swipe = nbgl_detectSwipe(touchStatePosition, &firstTouchedPosition); bool consumed = false; + lastState = touchStatePosition->state; if (swipe != NB_TOUCH_TYPES) { // Swipe detected nbgl_obj_t *swipedObj = getSwipableObject( @@ -336,6 +337,7 @@ void nbgl_touchHandler(nbgl_touchStatePosition_t *touchStatePosition, uint32_t c } else { // PRESSED if ((lastState == PRESSED) && (lastPressedObj != NULL)) { + lastState = touchStatePosition->state; if (foundObj != lastPressedObj) { // finger has moved out of an object // make sure lastPressedObj still belongs to current screen before warning it @@ -350,6 +352,7 @@ void nbgl_touchHandler(nbgl_touchStatePosition_t *touchStatePosition, uint32_t c } } else if (lastState == RELEASED) { + lastState = touchStatePosition->state; // newly touched object lastPressedObj = foundObj; lastPressedTime = currentTime; @@ -357,8 +360,6 @@ void nbgl_touchHandler(nbgl_touchStatePosition_t *touchStatePosition, uint32_t c applytouchStatePosition(foundObj, TOUCHING); } } - - lastState = touchStatePosition->state; } bool nbgl_touchGetTouchedPosition(nbgl_obj_t *obj,