Put things out of loop

This commit is contained in:
jpirnay
2026-04-08 14:43:16 +02:00
parent 07906853d6
commit e719d3d457
4 changed files with 12 additions and 27 deletions
+9 -15
View File
@@ -131,8 +131,6 @@ void HomeActivity::loadRecentBooks(int maxBooks) {
void HomeActivity::loadRecentCovers(int coverHeight) {
recentsLoading = true;
bool showingLoading = false;
Rect popupRect;
int progress = 0;
for (RecentBook& book : recentBooks) {
@@ -146,11 +144,6 @@ void HomeActivity::loadRecentCovers(int coverHeight) {
epub.load(false, true);
// Try to generate thumbnail image for Continue Reading card
if (!showingLoading) {
showingLoading = true;
popupRect = GUI.drawPopup(renderer, tr(STR_LOADING_POPUP));
}
GUI.fillPopupProgress(renderer, popupRect, 10 + progress * (90 / recentBooks.size()));
bool success = epub.generateThumbBmp(coverHeight);
if (!success) {
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, "");
@@ -163,11 +156,6 @@ void HomeActivity::loadRecentCovers(int coverHeight) {
Xtc xtc(book.path, "/.crosspoint");
if (xtc.load()) {
// Try to generate thumbnail image for Continue Reading card
if (!showingLoading) {
showingLoading = true;
popupRect = GUI.drawPopup(renderer, tr(STR_LOADING_POPUP));
}
GUI.fillPopupProgress(renderer, popupRect, 10 + progress * (90 / recentBooks.size()));
bool success = xtc.generateThumbBmp(coverHeight);
if (!success) {
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, "");
@@ -251,6 +239,15 @@ void HomeActivity::freeCoverBuffer() {
}
void HomeActivity::loop() {
if (firstRenderDone && !recentsLoaded && !recentsLoading) {
const auto& metrics = UITheme::getInstance().getMetrics();
const Rect contentRect = UITheme::getContentRect(renderer, true, false);
const int menuItemCount = hasOpdsUrl ? 6 : 5;
const HomeScreenLayout layout = computeHomeScreenLayout(metrics, contentRect.height, menuItemCount);
loadRecentCovers(getHomeCoverRenderHeight(layout));
return;
}
const int menuCount = getMenuItemCount();
buttonNavigator.onNext([this, menuCount] {
@@ -336,9 +333,6 @@ void HomeActivity::render(RenderLock&&) {
if (!firstRenderDone) {
firstRenderDone = true;
requestUpdate();
} else if (!recentsLoaded && !recentsLoading) {
recentsLoading = true;
loadRecentCovers(getHomeCoverRenderHeight(layout));
}
}
+1 -4
View File
@@ -110,10 +110,7 @@ void EpubReaderActivity::onExit() {
Activity::onExit();
// Reset orientation back to portrait for the rest of the UI
{
RenderLock lock(*this);
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
}
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
APP_STATE.readerActivityLoadCount = 0;
APP_STATE.saveToFile();
+1 -4
View File
@@ -114,10 +114,7 @@ void TxtReaderActivity::onExit() {
Activity::onExit();
// Reset orientation back to portrait for the rest of the UI
{
RenderLock lock(*this);
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
}
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
pageOffsets.clear();
currentPageLines.clear();
+1 -4
View File
@@ -220,10 +220,7 @@ void WeatherActivity::onExit() {
Activity::onExit();
// Weather screen is always landscape; restore app UI to portrait on exit.
{
RenderLock lock(*this);
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
}
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
WiFi.mode(WIFI_OFF);
}