From 0e741a97e51e149c7ec897407126938fb50a9c8d Mon Sep 17 00:00:00 2001 From: bean <62624884+alpsfordays@users.noreply.github.com> Date: Tue, 20 Jan 2026 21:36:29 -0500 Subject: [PATCH] Wrap-around FontSelectionActivity.cpp, hiding /fonts Wrap-around navigation in FontSelection, normalization of selected font box appearance, hiding /fonts in file browser --- .../reader/FileSelectionActivity.cpp | 4 +++ .../settings/FontSelectionActivity.cpp | 30 +++++-------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/activities/reader/FileSelectionActivity.cpp b/src/activities/reader/FileSelectionActivity.cpp index 3014fcc3..8bdbb3b1 100644 --- a/src/activities/reader/FileSelectionActivity.cpp +++ b/src/activities/reader/FileSelectionActivity.cpp @@ -46,6 +46,10 @@ void FileSelectionActivity::loadFiles() { file.close(); continue; } + if (name[0] == '.' || strcmp(name, "fonts") == 0) { + file.close(); + continue; + } if (file.isDirectory()) { files.emplace_back(std::string(name) + "/"); diff --git a/src/activities/settings/FontSelectionActivity.cpp b/src/activities/settings/FontSelectionActivity.cpp index bd635d03..f7ab6879 100644 --- a/src/activities/settings/FontSelectionActivity.cpp +++ b/src/activities/settings/FontSelectionActivity.cpp @@ -51,29 +51,13 @@ void FontSelectionActivity::loop() { } if (mappedInput.wasPressed(MappedInputManager::Button::Up) || - mappedInput.wasPressed(MappedInputManager::Button::Left) || - mappedInput.wasPressed(MappedInputManager::Button::PageBack)) { - if (selectedIndex > 0) { - selectedIndex--; - if (selectedIndex < scrollOffset) { - scrollOffset = selectedIndex; - update = true; - } else { - update = true; - } - } + mappedInput.wasPressed(MappedInputManager::Button::Left)) { + selectedIndex = (selectedIndex > 0) ? (selectedIndex - 1) : ((int)fontFamilies.size() - 1); + update = true; } else if (mappedInput.wasPressed(MappedInputManager::Button::Down) || - mappedInput.wasPressed(MappedInputManager::Button::Right) || - mappedInput.wasPressed(MappedInputManager::Button::PageForward)) { - if (selectedIndex < (int)fontFamilies.size() - 1) { - selectedIndex++; - if (selectedIndex >= scrollOffset + itemsPerPage) { - scrollOffset = selectedIndex - itemsPerPage + 1; - update = true; - } else { - update = true; - } - } + mappedInput.wasPressed(MappedInputManager::Button::Right)) { + selectedIndex = (selectedIndex < (int)fontFamilies.size() - 1) ? (selectedIndex + 1) : 0; + update = true; } if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) { @@ -120,7 +104,7 @@ void FontSelectionActivity::render() const { // Draw selection box if (idx == selectedIndex) { Serial.printf("[FSA] Drawing selected: %s at %d\n", fontFamilies[idx].c_str(), y); - renderer.fillRect(10, y - 2, 460, 24); + renderer.fillRect(0, y - 2, 480, 30); renderer.drawText(UI_10_FONT_ID, 20, y, fontFamilies[idx].c_str(), false); // false = white (on black box) } else { Serial.printf("[FSA] Drawing: %s at %d\n", fontFamilies[idx].c_str(), y);