Proper linewrap and centering
This commit is contained in:
@@ -28,11 +28,23 @@ void ClearCacheActivity::render(RenderLock&&) {
|
||||
tr(STR_CLEAR_READING_CACHE));
|
||||
|
||||
const int midY = contentRect.y + contentRect.height / 2;
|
||||
const int lineHeight = renderer.getLineHeight(UI_10_FONT_ID);
|
||||
const int warnWidth = contentRect.width - 2 * metrics.contentSidePadding;
|
||||
if (state == WARNING) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, midY - 60, tr(STR_CLEAR_CACHE_WARNING_1), true);
|
||||
const auto warn1Lines = renderer.wrappedText(UI_10_FONT_ID, tr(STR_CLEAR_CACHE_WARNING_1), warnWidth, 3);
|
||||
int y = midY - 60;
|
||||
for (const auto& line : warn1Lines) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, y, line.c_str());
|
||||
y += lineHeight;
|
||||
}
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, midY - 30, tr(STR_CLEAR_CACHE_WARNING_2), true, EpdFontFamily::BOLD);
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, midY + 10, tr(STR_CLEAR_CACHE_WARNING_3), true);
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, midY + 30, tr(STR_CLEAR_CACHE_WARNING_4), true);
|
||||
const std::string warn34 = std::string(tr(STR_CLEAR_CACHE_WARNING_3)) + " " + tr(STR_CLEAR_CACHE_WARNING_4);
|
||||
const auto warn34Lines = renderer.wrappedText(UI_10_FONT_ID, warn34.c_str(), warnWidth, 3);
|
||||
y = midY + 10;
|
||||
for (const auto& line : warn34Lines) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, y, line.c_str());
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
const auto labels = mappedInput.mapLabels(tr(STR_CANCEL), tr(STR_CLEAR_BUTTON), "", "");
|
||||
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||
|
||||
@@ -160,7 +160,13 @@ void OtaUpdateActivity::render(RenderLock&&) {
|
||||
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||
} else if (state == FINISHED) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, top, tr(STR_UPDATE_COMPLETE), true, EpdFontFamily::BOLD);
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, top + height + metrics.verticalSpacing, tr(STR_POWER_ON_HINT));
|
||||
const int hintWidth = contentRect.width - 2 * metrics.contentSidePadding;
|
||||
const auto hintLines = renderer.wrappedText(UI_10_FONT_ID, tr(STR_POWER_ON_HINT), hintWidth, 4);
|
||||
int hintY = top + height + metrics.verticalSpacing;
|
||||
for (const auto& line : hintLines) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, hintY, line.c_str());
|
||||
hintY += height;
|
||||
}
|
||||
}
|
||||
|
||||
renderer.displayBuffer();
|
||||
|
||||
@@ -230,7 +230,13 @@ void SdFirmwareUpdateActivity::render(RenderLock&&) {
|
||||
} else {
|
||||
// PICKING / CONFIRMING: a sub-activity is on top, nothing to draw.
|
||||
if (recoveryMode) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, top, tr(STR_RECOVERY_MODE_HINT));
|
||||
const int hintWidth = pageWidth - 2 * metrics.contentSidePadding;
|
||||
const auto hintLines = renderer.wrappedText(UI_10_FONT_ID, tr(STR_RECOVERY_MODE_HINT), hintWidth, 4);
|
||||
int hintY = top;
|
||||
for (const auto& line : hintLines) {
|
||||
renderer.drawCenteredText(UI_10_FONT_ID, hintY, line.c_str());
|
||||
hintY += lineHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user