меню уведомлений: подсказка о кнопках не накладывается на строку списка при правке значения

This commit is contained in:
shade committed 2026-10-15 21:35:10 +03:00
1 parent 6be7ab8746
commit 2831eab62c
1 file changed
+19 -7
+19 -7
View File
@@ -1510,6 +1510,18 @@ void HomeScreen::notifyActivate() { // длинное нажатие
}
}
// Подсказка о кнопках внизу экрана. Полосу сначала затираем: иначе текст ложится
// поверх последней строки списка (например, поверх «Save & exit» при правке Timezone).
static void drawBottomHint(DisplayDriver& display, const char* text) {
const int h = 10;
const int y = display.height() - h;
display.setTextSize(1);
display.setColor(UIColor::window_bkg);
display.fillRect(0, y, display.width(), h);
display.setColor(UIColor::warning_txt);
display.drawTextCentered(display.width() / 2, y + 1, text);
}
void HomeScreen::renderNotifyMenu(DisplayDriver& display) {
char buf[24];
char val[16];
@@ -1526,8 +1538,7 @@ void HomeScreen::renderNotifyMenu(DisplayDriver& display) {
drawMenuRow(display, y, r == _notify_sel, names[r], val);
}
if (_notify_val_edit) {
display.setColor(UIColor::warning_txt);
display.drawTextCentered(display.width() / 2, 64 - 10, "click+ dbl- hold=back");
drawBottomHint(display, "click+ dbl- hold=back");
}
return;
}
@@ -1564,11 +1575,13 @@ void HomeScreen::renderNotifyMenu(DisplayDriver& display) {
"Unread", "Popups", "Wake screen", "Alerts", "Channels", "Timezone", "Quiet hours", "Save & exit"
};
static const char* alert_names[4] = { "sound+vibe", "sound", "vibe", "off" };
// на узких экранах (128x64) все восемь строк не помещаются — список прокручивается
const uint8_t visible = display.height() >= 100 ? NOTIFY_MAIN_ROWS : 7;
// на узких экранах (128x64) все восемь строк не помещаются — список прокручивается;
// в режиме правки значения нижнюю строку отдаём под подсказку о кнопках
const uint8_t maxRows = display.height() >= 100 ? NOTIFY_MAIN_ROWS : 7;
const uint8_t visible = _notify_val_edit ? (uint8_t)(maxRows - 1) : maxRows;
uint8_t first = _notify_sel >= visible ? (uint8_t)(_notify_sel - visible + 1) : 0;
int y = 1;
for (uint8_t r = first; r < NOTIFY_MAIN_ROWS; r++, y += 9) {
for (uint8_t r = first; r < NOTIFY_MAIN_ROWS && (r - first) < visible; r++, y += 9) {
val[0] = 0;
switch (r) {
case 0: snprintf(val, sizeof(val), "%d", _task->getMsgCount()); break;
@@ -1586,8 +1599,7 @@ void HomeScreen::renderNotifyMenu(DisplayDriver& display) {
drawMenuRow(display, y, r == _notify_sel, labels[r], val);
}
if (_notify_val_edit) {
display.setColor(UIColor::warning_txt);
display.drawTextCentered(display.width() / 2, display.height() - 10, "click+ dbl- hold=back");
drawBottomHint(display, "click+ dbl- hold=back");
}
}