This commit is contained in:
jpirnay
2026-05-20 00:14:51 +02:00
parent 4b0c99f35d
commit dddb3c1bcb
2 changed files with 8 additions and 12 deletions
@@ -55,7 +55,7 @@ std::string formatDateOrRelative(time_t epoch) {
return buf; return buf;
} }
// Past a month, the relative form ("60d ago") is noisier than a date. // Past a month, the relative form ("60d ago") is noisier than a date.
struct tm t {}; struct tm t{};
localtime_r(&epoch, &t); localtime_r(&epoch, &t);
snprintf(buf, sizeof(buf), "%04d-%02d-%02d", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); snprintf(buf, sizeof(buf), "%04d-%02d-%02d", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday);
return buf; return buf;
@@ -58,18 +58,15 @@ void ReadingStatsBookListActivity::loop() {
} }
if (!sortedBooks.empty()) { if (!sortedBooks.empty()) {
buttonNavigator.onNextList(selectedIndex, static_cast<int>(sortedBooks.size()), buttonNavigator.onNextList(selectedIndex, static_cast<int>(sortedBooks.size()), [this]() { requestUpdate(); });
[this]() { requestUpdate(); }); buttonNavigator.onPreviousList(selectedIndex, static_cast<int>(sortedBooks.size()), [this]() { requestUpdate(); });
buttonNavigator.onPreviousList(selectedIndex, static_cast<int>(sortedBooks.size()),
[this]() { requestUpdate(); });
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) { if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
const BookReadingStats* book = sortedBooks[selectedIndex]; const BookReadingStats* book = sortedBooks[selectedIndex];
startActivityForResult( startActivityForResult(std::make_unique<ReadingStatsBookDetailActivity>(renderer, mappedInput, book->docId),
std::make_unique<ReadingStatsBookDetailActivity>(renderer, mappedInput, book->docId), // After detail closes the underlying store hasn't changed (it's
// After detail closes the underlying store hasn't changed (it's // read-only), so just redraw — selectedIndex is preserved.
// read-only), so just redraw — selectedIndex is preserved. [this](const ActivityResult&) { requestUpdate(); });
[this](const ActivityResult&) { requestUpdate(); });
} }
} }
} }
@@ -105,8 +102,7 @@ void ReadingStatsBookListActivity::render(RenderLock&&) {
// theme as "no subtitle" and the row collapses to a single line. // theme as "no subtitle" and the row collapses to a single line.
return sortedBooks[index]->author; return sortedBooks[index]->author;
}, },
nullptr, nullptr, [this](int index) { return formatDuration(sortedBooks[index]->totalSeconds); }, true);
[this](int index) { return formatDuration(sortedBooks[index]->totalSeconds); }, true);
} }
const auto labels = const auto labels =