feat(keyboard): add password mode with toggle, cursor visual improvements, and layout unification

This commit is contained in:
pablohc
2026-04-15 11:57:13 +02:00
committed by jpirnay
parent 226e8cf4ed
commit 0491587df8
10 changed files with 278 additions and 166 deletions
+9 -7
View File
@@ -14,18 +14,20 @@ struct KeyDef {
char secondary;
};
enum SpecialKeyType { SpecShift, SpecMode, SpecReveal, SpecSpace, SpecDel, SpecOk };
enum SpecialKeyType { SpecShift, SpecMode, SpecSpace, SpecDel, SpecOk };
enum class InputType { Text, Password, Url };
class KeyboardEntryActivity : public Activity {
public:
explicit KeyboardEntryActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
std::string title = "Enter Text", std::string initialText = "",
const size_t maxLength = 0, const bool isPassword = false)
const size_t maxLength = 0, InputType inputType = InputType::Text)
: Activity("KeyboardEntry", renderer, mappedInput),
title(std::move(title)),
text(std::move(initialText)),
maxLength(maxLength),
isPassword(isPassword) {}
inputType(inputType) {}
void onEnter() override;
void onExit() override;
@@ -36,7 +38,7 @@ class KeyboardEntryActivity : public Activity {
std::string title;
std::string text;
size_t maxLength;
bool isPassword;
InputType inputType;
bool passwordVisible = false;
ButtonNavigator buttonNavigator;
@@ -59,10 +61,12 @@ class KeyboardEntryActivity : public Activity {
void onCancel();
static constexpr uint16_t LONG_PRESS_MS = 500;
static constexpr uint16_t DEL_LONG_PRESS_MS = 1500;
static constexpr int COLS = 10;
static constexpr int ABC_ROWS = 4;
static constexpr int SYM_ROWS = 4;
static constexpr int BOTTOM_KEY_COUNT = 5;
static constexpr KeyDef abcLayout[ABC_ROWS][COLS] = {
{{'0', ')'},
@@ -150,12 +154,10 @@ class KeyboardEntryActivity : public Activity {
{'`', '\0'}},
};
const char* getShiftLabel() const;
static const char* const shiftString[2];
int getContentRowCount() const;
int getTotalRowCount() const;
int getBottomKeyCount() const;
SpecialKeyType getBottomSpecialKey(int index) const;
bool isBottomRow(int row) const;
char getSelectedChar() const;
char getAlternativeChar() const;