refactor(ui): drawSelectionRow helper for the 5-line invert/restore pattern

Eight screens repeated the same if/else block to invert the row
background for selected items. Add DisplayDriver::drawSelectionRow that
sets LIGHT, optionally fills the rect, and leaves the colour as DARK
when sel (so the caller's text renders inverted). 61 lines removed
across SettingsScreen, KeyboardWidget (cells + special row), ToolsScreen,
DashboardConfigScreen, BotScreen, RingtoneEditorScreen (note slots +
menu), NearbyScreen, QuickMsgScreen (4 list views).

Card-style rows (QuickMsg hist, NearbyScreen discover, RingtoneEditor
notes display) keep their original drawRect/partial-fill outline for
unselected — they don't match the simple-invert pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-24 20:33:02 +02:00
co-authored by Claude Sonnet 4.6
parent 52a7081a13
commit d981f93e6e
9 changed files with 25 additions and 86 deletions
+1 -4
View File
@@ -68,10 +68,7 @@ public:
for (int i = 0; i < ITEM_COUNT; i++) {
int y = start_y + i * item_h;
bool sel = (i == _sel);
if (sel) {
display.fillRect(0, y - 1, display.width(), item_h);
display.setColor(DisplayDriver::DARK);
}
display.drawSelectionRow(0, y - 1, display.width(), item_h, sel);
display.setCursor(2, y);
display.print(labels[i]);
display.setCursor(val_x, y);