diff --git a/src/RecentBooksStore.cpp b/src/RecentBooksStore.cpp index ac7fab34..5932de36 100644 --- a/src/RecentBooksStore.cpp +++ b/src/RecentBooksStore.cpp @@ -14,15 +14,10 @@ constexpr int MAX_RECENT_BOOKS = 10; RecentBooksStore RecentBooksStore::instance; -void RecentBooksStore::addBook( - const std::string& path, - const std::string& title, - const std::string& author) { +void RecentBooksStore::addBook(const std::string& path, const std::string& title, const std::string& author) { // Remove existing entry if present - auto it = std::find_if( - recentBooks.begin(), recentBooks.end(), [&](const RecentBook& book) { - return book.path == path; - }); + auto it = + std::find_if(recentBooks.begin(), recentBooks.end(), [&](const RecentBook& book) { return book.path == path; }); if (it != recentBooks.end()) { recentBooks.erase(it); } @@ -58,10 +53,7 @@ bool RecentBooksStore::saveToFile() const { } outputFile.close(); - Serial.printf( - "[%lu] [RBS] Recent books saved to file (%d entries)\n", - millis(), - count); + Serial.printf("[%lu] [RBS] Recent books saved to file (%d entries)\n", millis(), count); return true; } @@ -88,10 +80,7 @@ bool RecentBooksStore::loadFromFile() { recentBooks.push_back({path, "", ""}); } } else { - Serial.printf( - "[%lu] [RBS] Deserialization failed: Unknown version %u\n", - millis(), - version); + Serial.printf("[%lu] [RBS] Deserialization failed: Unknown version %u\n", millis(), version); inputFile.close(); return false; } @@ -112,9 +101,6 @@ bool RecentBooksStore::loadFromFile() { } inputFile.close(); - Serial.printf( - "[%lu] [RBS] Recent books loaded from file (%d entries)\n", - millis(), - recentBooks.size()); + Serial.printf("[%lu] [RBS] Recent books loaded from file (%d entries)\n", millis(), recentBooks.size()); return true; } diff --git a/src/RecentBooksStore.h b/src/RecentBooksStore.h index b0db8c82..7b87f1e0 100644 --- a/src/RecentBooksStore.h +++ b/src/RecentBooksStore.h @@ -23,10 +23,7 @@ class RecentBooksStore { static RecentBooksStore& getInstance() { return instance; } // Add a book to the recent list (moves to front if already exists) - void addBook( - const std::string& path, - const std::string& title, - const std::string& author); + void addBook(const std::string& path, const std::string& title, const std::string& author); // Get the list of recent books (most recent first) const std::vector& getBooks() const { return recentBooks; } diff --git a/src/activities/home/MyLibraryActivity.cpp b/src/activities/home/MyLibraryActivity.cpp index 1d7df1de..108d2078 100644 --- a/src/activities/home/MyLibraryActivity.cpp +++ b/src/activities/home/MyLibraryActivity.cpp @@ -16,7 +16,7 @@ namespace { constexpr int TAB_BAR_Y = 15; constexpr int CONTENT_START_Y = 60; constexpr int LINE_HEIGHT = 30; -constexpr int RECENTS_LINE_HEIGHT = 65; // Increased for two-line items +constexpr int RECENTS_LINE_HEIGHT = 65; // Increased for two-line items constexpr int LEFT_MARGIN = 20; constexpr int RIGHT_MARGIN = 40; // Extra space for scroll indicator @@ -323,8 +323,8 @@ void MyLibraryActivity::renderRecentTab() const { const auto pageStartIndex = selectorIndex / pageItems * pageItems; // Draw selection highlight - renderer.fillRect(0, CONTENT_START_Y + (selectorIndex % pageItems) * RECENTS_LINE_HEIGHT - 2, pageWidth - RIGHT_MARGIN, - RECENTS_LINE_HEIGHT); + renderer.fillRect(0, CONTENT_START_Y + (selectorIndex % pageItems) * RECENTS_LINE_HEIGHT - 2, + pageWidth - RIGHT_MARGIN, RECENTS_LINE_HEIGHT); // Draw items for (int i = pageStartIndex; i < bookCount && i < pageStartIndex + pageItems; i++) { @@ -346,7 +346,7 @@ void MyLibraryActivity::renderRecentTab() const { } } auto truncatedTitle = renderer.truncatedText(UI_12_FONT_ID, title.c_str(), pageWidth - LEFT_MARGIN - RIGHT_MARGIN); - renderer.drawText(UI_12_FONT_ID, LEFT_MARGIN, y + 3, truncatedTitle.c_str(), i != selectorIndex); + renderer.drawText(UI_12_FONT_ID, LEFT_MARGIN, y + 2, truncatedTitle.c_str(), i != selectorIndex); // Line 2: Author if (!book.author.empty()) {