mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 02:36:11 +00:00
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:
co-authored by
Claude Sonnet 4.6
parent
52a7081a13
commit
d981f93e6e
@@ -25,13 +25,7 @@ public:
|
||||
for (int i = 0; i < ITEM_COUNT; i++) {
|
||||
int y = start_y + i * item_h;
|
||||
bool sel = (i == _sel);
|
||||
if (sel) {
|
||||
display.setColor(DisplayDriver::LIGHT);
|
||||
display.fillRect(0, y - 1, display.width(), item_h);
|
||||
display.setColor(DisplayDriver::DARK);
|
||||
} else {
|
||||
display.setColor(DisplayDriver::LIGHT);
|
||||
}
|
||||
display.drawSelectionRow(0, y - 1, display.width(), item_h, sel);
|
||||
display.setCursor(0, y);
|
||||
display.print(sel ? ">" : " ");
|
||||
display.setCursor(cw + 2, y);
|
||||
|
||||
Reference in New Issue
Block a user