Add show/hide password toggle button (EYE) on password entry screen
This commit is contained in:
parent
93dfd86cc2
commit
6c15896fdb
1 changed files with 19 additions and 2 deletions
19
src/main.cpp
19
src/main.cpp
|
|
@ -190,6 +190,7 @@ String wifiPassword = "";
|
|||
bool keyboardShift = false;
|
||||
bool keyboardCaps = false;
|
||||
bool keyboardSymbols = false;
|
||||
bool showPasswordPlain = false;
|
||||
|
||||
String formatPriceUS(double price, int decimals = 2, bool includeDollar = true) {
|
||||
if (price <= 0) return "...";
|
||||
|
|
@ -882,19 +883,29 @@ void drawWifiPasswordScreen() {
|
|||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
lcd.drawString("Network: " + selectedSSID, 50, 70);
|
||||
|
||||
lcd.fillSmoothRoundRect(50, 100, SCREEN_WIDTH - 100, 50, 8, TFT_DARKGRAY);
|
||||
lcd.fillSmoothRoundRect(50, 100, SCREEN_WIDTH - 160, 50, 8, TFT_DARKGRAY);
|
||||
lcd.setTextColor(TFT_WHITE, TFT_DARKGRAY);
|
||||
lcd.setFont(&fonts::DejaVu18);
|
||||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
|
||||
String displayPwd = "";
|
||||
if (showPasswordPlain) {
|
||||
displayPwd = String(keyboardBuffer);
|
||||
} else {
|
||||
for (int i = 0; i < keyboardPos; i++) displayPwd += "*";
|
||||
}
|
||||
if (keyboardPos == 0) {
|
||||
lcd.setTextColor(TFT_GRAY, TFT_DARKGRAY);
|
||||
displayPwd = "_";
|
||||
}
|
||||
lcd.drawString(displayPwd, 70, 125);
|
||||
|
||||
lcd.fillSmoothRoundRect(SCREEN_WIDTH - 100, 100, 50, 50, 8, showPasswordPlain ? TFT_ORANGE : TFT_GRAY);
|
||||
lcd.setTextColor(TFT_WHITE, showPasswordPlain ? TFT_ORANGE : TFT_GRAY);
|
||||
lcd.setFont(&fonts::DejaVu12);
|
||||
lcd.setTextDatum(textdatum_t::middle_center);
|
||||
lcd.drawString("EYE", SCREEN_WIDTH - 75, 125);
|
||||
|
||||
drawFullKeyboard(170, keyboardSymbols);
|
||||
|
||||
lcd.fillSmoothRoundRect(50, SCREEN_HEIGHT - 50, 150, 40, 8, TFT_GRAY);
|
||||
|
|
@ -1062,6 +1073,11 @@ bool handleWifiPasswordTouch(int32_t x, int32_t y) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (x >= SCREEN_WIDTH - 100 && x < SCREEN_WIDTH - 50 && y >= 100 && y < 150) {
|
||||
showPasswordPlain = !showPasswordPlain;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* letterRows[] = {
|
||||
"QWERTYUIOP",
|
||||
"ASDFGHJKL",
|
||||
|
|
@ -1276,6 +1292,7 @@ bool handleDashboardTouch(int32_t x, int32_t y) {
|
|||
keyboardCaps = false;
|
||||
keyboardShift = false;
|
||||
keyboardSymbols = false;
|
||||
showPasswordPlain = false;
|
||||
scanWifiNetworks();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue