| 122 | } |
| 123 | |
| 124 | void RecentBooksActivity::render(RenderLock&&) { |
| 125 | renderer.clearScreen(); |
| 126 | |
| 127 | const auto pageWidth = renderer.getScreenWidth(); |
| 128 | const auto pageHeight = renderer.getScreenHeight(); |
| 129 | const auto& metrics = UITheme::getInstance().getMetrics(); |
| 130 | |
| 131 | GUI.drawHeader(renderer, Rect{0, metrics.topPadding, pageWidth, metrics.headerHeight}, tr(STR_MENU_RECENT_BOOKS)); |
| 132 | |
| 133 | const int contentTop = metrics.topPadding + metrics.headerHeight + metrics.verticalSpacing; |
| 134 | const int contentHeight = pageHeight - contentTop - metrics.buttonHintsHeight - metrics.verticalSpacing; |
| 135 | |
| 136 | // Recent tab |
| 137 | if (recentBooks.empty()) { |
| 138 | renderer.drawText(UI_10_FONT_ID, metrics.contentSidePadding, contentTop + 20, tr(STR_NO_RECENT_BOOKS)); |
| 139 | } else { |
| 140 | GUI.drawList( |
| 141 | renderer, Rect{0, contentTop, pageWidth, contentHeight}, recentBooks.size(), selectorIndex, |
| 142 | [this](int index) { return recentBooks[index].title; }, [this](int index) { return recentBooks[index].author; }, |
| 143 | [this](int index) { return UITheme::getFileIcon(recentBooks[index].path); }); |
| 144 | } |
| 145 | |
| 146 | // Help text |
| 147 | const auto labels = mappedInput.mapLabels(tr(STR_HOME), tr(STR_OPEN), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); |
| 148 | GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); |
| 149 | |
| 150 | renderer.displayBuffer(); |
| 151 | } |
nothing calls this directly
no test coverage detected