Add example-name hint to the preset-name keyboard

The preset-name keypad (used both when adding a preset via manual
coordinates and after an address search) only showed "Name
(optional):" with no indication of what kind of name was expected.
Adds a localized hint line with example names (e.g. "Home, Work,
Holiday home") under the title in both runPresetNameKeypad()
(location_presets_screen.cpp) and runNameKeypad()
(address_search_screen.cpp), measuring the header height dynamically
via getCursorY() the same way runAddressKeyboard() already does, so
the input field and keyboard shift down to make room regardless of
translation length.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Eiswolf-BG
2026-08-11 01:18:14 +02:00
parent 795c008af6
commit a757d693e7
9 changed files with 58 additions and 11 deletions

View File

@@ -296,7 +296,19 @@ namespace {
constexpr int16_t KEY_H = 30;
constexpr int16_t KEY_GAP = 3;
constexpr int16_t ROW0_Y = 78;
constexpr int16_t FIELD_H = 34;
// Kopfbereich (Titel + Namens-Hinweis) einmal zeichnen, um seine
// tatsaechliche Hoehe per getCursorY() zu messen - selbes Muster wie
// in runAddressKeyboard() oben.
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setCursor(10, 14);
tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT));
tft.setTextColor(TFT_CYAN, TFT_BLACK);
tft.println(I18n::t(StringId::LOCATION_NAME_HINT));
int16_t fieldY = (int16_t)(tft.getCursorY() + 4);
int16_t ROW0_Y = (int16_t)(fieldY + FIELD_H + 8);
auto layoutRow = [&](const char* row, int16_t y, Rect* outRects, uint8_t n) {
int16_t usableW = Config::SCREEN_WIDTH - 8;
@@ -326,12 +338,14 @@ namespace {
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setCursor(10, 14);
tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT));
tft.setTextColor(TFT_CYAN, TFT_BLACK);
tft.println(I18n::t(StringId::LOCATION_NAME_HINT));
tft.fillRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_BLACK);
tft.drawRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_GREEN);
tft.fillRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_BLACK);
tft.drawRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_GREEN);
tft.setTextSize(2);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setCursor(14, 66);
tft.setCursor(14, (int16_t)(fieldY + 26));
tft.print(buf);
tft.setTextSize(1);