16#include <goodisplay/gdey029T94.h>
19static const char*
TAG =
"T9InputView";
30 ".@?!,;:'\"()-_#$%&*+=/\\<>[]{}|^~`1"
31 "\x9B\x9C\x9D\xA8\xAD\xAE\xAF\xAB\xAC\xF1\xF8\xFD\xE6\xF6",
32 "abcABC2\x84\xA0\x83\x85\x86\x91\x8E\x8F\x92\x87\x80",
33 "defDEF3\x82\x8A\x88\x89\x90",
34 "ghiGHI4\xA1\x8D\x8C\x8B",
36 "mnoMNO6\xA2\x95\x93\x94\x99\xA4\xA5",
38 "tuvTUV8\x81\x9A\xA3\x97\x96",
90 LOG_D(
TAG,
"init: title='%s', maxLen=%d", title ? title :
"(null)",
maxLen_);
100 if (key <
'0' || key >
'9')
return '\0';
101 const char* chars =
t9_chars[key -
'0'];
102 uint8_t count = strlen(chars);
103 return chars[index % count];
112 if (key <
'0' || key >
'9')
return 0;
122 if (key <
'0' || key >
'9')
return false;
124 uint32_t now =
static_cast<uint32_t
>(esp_timer_get_time() / 1000ULL);
128 if (sameKey && !timeout &&
len_ > 0) {
177 if (key <
'0' || key >
'9')
return;
186 LOG_D(
TAG,
"forceDigit (replace): key='%c', text='%s'", key,
text_);
196 LOG_D(
TAG,
"forceDigit (append): key='%c', text='%s'", key,
text_);
239 uint32_t now =
static_cast<uint32_t
>(esp_timer_get_time() / 1000ULL);
269 if (key >=
'0' && key <=
'9') {
293 if (key >=
'0' && key <=
'9') {
319 auto* gfx =
static_cast<Gdey029T94*
>(
display->getNativeHandle());
322 const uint16_t width =
display->getWidth();
323 const uint16_t height =
display->getHeight();
326 gfx->fillScreen(EPD_WHITE);
329 gfx->setTextColor(EPD_BLACK);
343 gfx->setTextColor(EPD_DARKGREY);
345 gfx->setTextColor(EPD_BLACK);
348 for (uint16_t i = 0; i <
len_; i++) {
351 int16_t x = gfx->getCursorX();
352 int16_t y = gfx->getCursorY();
353 gfx->fillRect(x, y - 2, 8, 14, EPD_BLACK);
354 gfx->setTextColor(EPD_WHITE);
355 gfx->print(
text_[i]);
356 gfx->setTextColor(EPD_BLACK);
358 gfx->print(
text_[i]);
370 snprintf(countStr,
sizeof(countStr),
"%u/%u ",
len_,
maxLen_);
Internationalization with English fallbacks in code and overlay translations loaded at runtime from a...
static constexpr int TEXT_MARGIN
static constexpr int TITLE_Y
Display layout constants.
CDC Log: logging over TinyUSB CDC and UART.
#define LOG_D(tag, fmt,...)
static ViewStack & instance()
Returns singleton view-stack instance.
void push(IView *view, void *context=nullptr)
IDisplay * getDisplayInstance()
Returns lazily created singleton display instance.
void drawFooterBar(Gdey029T94 *gfx, uint16_t width, uint16_t height, const char *prefix, const char *hint, bool force=false)
Draws footer bar with optional prefix and hint text.
void drawHeaderLeft(Gdey029T94 *gfx, const char *title, int x, int y, uint16_t width, int underlineOffset=18)
void printText(Gdey029T94 *gfx, const char *text)
Draws CP437 text with the built-in 6x8 glyph font, byte-for-byte.
Centralized key-code constants for cdc_views.
const char * tr(const char *key)
Look up a translation by string key.
static constexpr int TEXT_Y
static T9InputView s_sharedT9Input
Convenience factory/helper function.
static constexpr char KEY_NO
Cancel / Back / Backspace.
T9InputView * showT9Input(const char *title, const char *initialText, T9InputView::SaveCallback onSave, uint16_t maxLen=128)
Shows a shared T9 input view instance.
static constexpr int TITLE_Y
Layout constants mirror the ones used by T9InputView.
void showToastError(const char *message, uint16_t durationMs=1500)
Shows an error toast message.
static constexpr char KEY_YES
Confirm / OK / Save.
static constexpr int TEXT_MARGIN