clf
This commit is contained in:
@@ -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 =
|
||||||
|
|||||||
Reference in New Issue
Block a user