mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-08 08:37:38 +03:00
Compare commits
3 Commits
7aee7ad06c
...
fa63c7c865
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa63c7c865 | ||
|
|
d403044f76 | ||
|
|
38ee755033 |
@ -546,8 +546,8 @@ void WifiSelectionActivity::renderNetworkList() const {
|
|||||||
|
|
||||||
// Draw network name (truncate if too long)
|
// Draw network name (truncate if too long)
|
||||||
std::string displayName = network.ssid;
|
std::string displayName = network.ssid;
|
||||||
if (displayName.length() > 16) {
|
if (displayName.length() > 33) {
|
||||||
displayName.replace(13, displayName.length() - 13, "...");
|
displayName.replace(30, displayName.length() - 30, "...");
|
||||||
}
|
}
|
||||||
renderer.drawText(UI_10_FONT_ID, 20, networkY, displayName.c_str());
|
renderer.drawText(UI_10_FONT_ID, 20, networkY, displayName.c_str());
|
||||||
|
|
||||||
|
|||||||
@ -92,8 +92,26 @@ void KeyboardEntryActivity::handleKeyPress() {
|
|||||||
// Handle special row (bottom row with shift, space, backspace, done)
|
// Handle special row (bottom row with shift, space, backspace, done)
|
||||||
if (selectedRow == SPECIAL_ROW) {
|
if (selectedRow == SPECIAL_ROW) {
|
||||||
if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) {
|
if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) {
|
||||||
// Shift toggle
|
// Shift toggle (double-tap enables caps lock)
|
||||||
|
const unsigned long now = millis();
|
||||||
|
const bool isDoubleTap = (lastShiftTapMs != 0) && ((now - lastShiftTapMs) <= SHIFT_DOUBLE_TAP_MS);
|
||||||
|
|
||||||
|
if (capsLockActive) {
|
||||||
|
capsLockActive = false;
|
||||||
|
shiftActive = false;
|
||||||
|
lastShiftTapMs = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDoubleTap) {
|
||||||
|
capsLockActive = true;
|
||||||
|
shiftActive = true;
|
||||||
|
lastShiftTapMs = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
shiftActive = !shiftActive;
|
shiftActive = !shiftActive;
|
||||||
|
lastShiftTapMs = now;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +149,9 @@ void KeyboardEntryActivity::handleKeyPress() {
|
|||||||
if (maxLength == 0 || text.length() < maxLength) {
|
if (maxLength == 0 || text.length() < maxLength) {
|
||||||
text += c;
|
text += c;
|
||||||
// Auto-disable shift after typing a letter
|
// Auto-disable shift after typing a letter
|
||||||
if (shiftActive && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) {
|
if (shiftActive && !capsLockActive && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) {
|
||||||
shiftActive = false;
|
shiftActive = false;
|
||||||
|
lastShiftTapMs = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,7 +337,8 @@ void KeyboardEntryActivity::render() const {
|
|||||||
|
|
||||||
// SHIFT key (logical col 0, spans 2 key widths)
|
// SHIFT key (logical col 0, spans 2 key widths)
|
||||||
const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL);
|
const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL);
|
||||||
renderItemWithSelector(currentX + 2, rowY, shiftActive ? "SHIFT" : "shift", shiftSelected);
|
const char* shiftLabel = capsLockActive ? "CAPS" : (shiftActive ? "SHIFT" : "shift");
|
||||||
|
renderItemWithSelector(currentX + 2, rowY, shiftLabel, shiftSelected);
|
||||||
currentX += 2 * (keyWidth + keySpacing);
|
currentX += 2 * (keyWidth + keySpacing);
|
||||||
|
|
||||||
// Space bar (logical cols 2-6, spans 5 key widths)
|
// Space bar (logical cols 2-6, spans 5 key widths)
|
||||||
|
|||||||
@ -71,6 +71,10 @@ class KeyboardEntryActivity : public Activity {
|
|||||||
int selectedRow = 0;
|
int selectedRow = 0;
|
||||||
int selectedCol = 0;
|
int selectedCol = 0;
|
||||||
bool shiftActive = false;
|
bool shiftActive = false;
|
||||||
|
bool capsLockActive = false;
|
||||||
|
unsigned long lastShiftTapMs = 0;
|
||||||
|
|
||||||
|
static constexpr unsigned long SHIFT_DOUBLE_TAP_MS = 500;
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
OnCompleteCallback onComplete;
|
OnCompleteCallback onComplete;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user