Put things out of loop
This commit is contained in:
@@ -131,8 +131,6 @@ void HomeActivity::loadRecentBooks(int maxBooks) {
|
|||||||
|
|
||||||
void HomeActivity::loadRecentCovers(int coverHeight) {
|
void HomeActivity::loadRecentCovers(int coverHeight) {
|
||||||
recentsLoading = true;
|
recentsLoading = true;
|
||||||
bool showingLoading = false;
|
|
||||||
Rect popupRect;
|
|
||||||
|
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
for (RecentBook& book : recentBooks) {
|
for (RecentBook& book : recentBooks) {
|
||||||
@@ -146,11 +144,6 @@ void HomeActivity::loadRecentCovers(int coverHeight) {
|
|||||||
epub.load(false, true);
|
epub.load(false, true);
|
||||||
|
|
||||||
// Try to generate thumbnail image for Continue Reading card
|
// 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);
|
bool success = epub.generateThumbBmp(coverHeight);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, "");
|
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");
|
Xtc xtc(book.path, "/.crosspoint");
|
||||||
if (xtc.load()) {
|
if (xtc.load()) {
|
||||||
// Try to generate thumbnail image for Continue Reading card
|
// 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);
|
bool success = xtc.generateThumbBmp(coverHeight);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, "");
|
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, "");
|
||||||
@@ -251,6 +239,15 @@ void HomeActivity::freeCoverBuffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HomeActivity::loop() {
|
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();
|
const int menuCount = getMenuItemCount();
|
||||||
|
|
||||||
buttonNavigator.onNext([this, menuCount] {
|
buttonNavigator.onNext([this, menuCount] {
|
||||||
@@ -336,9 +333,6 @@ void HomeActivity::render(RenderLock&&) {
|
|||||||
if (!firstRenderDone) {
|
if (!firstRenderDone) {
|
||||||
firstRenderDone = true;
|
firstRenderDone = true;
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
} else if (!recentsLoaded && !recentsLoading) {
|
|
||||||
recentsLoading = true;
|
|
||||||
loadRecentCovers(getHomeCoverRenderHeight(layout));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,10 +110,7 @@ void EpubReaderActivity::onExit() {
|
|||||||
Activity::onExit();
|
Activity::onExit();
|
||||||
|
|
||||||
// Reset orientation back to portrait for the rest of the UI
|
// Reset orientation back to portrait for the rest of the UI
|
||||||
{
|
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
||||||
RenderLock lock(*this);
|
|
||||||
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
|
||||||
}
|
|
||||||
|
|
||||||
APP_STATE.readerActivityLoadCount = 0;
|
APP_STATE.readerActivityLoadCount = 0;
|
||||||
APP_STATE.saveToFile();
|
APP_STATE.saveToFile();
|
||||||
|
|||||||
@@ -114,10 +114,7 @@ void TxtReaderActivity::onExit() {
|
|||||||
Activity::onExit();
|
Activity::onExit();
|
||||||
|
|
||||||
// Reset orientation back to portrait for the rest of the UI
|
// Reset orientation back to portrait for the rest of the UI
|
||||||
{
|
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
||||||
RenderLock lock(*this);
|
|
||||||
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
|
||||||
}
|
|
||||||
|
|
||||||
pageOffsets.clear();
|
pageOffsets.clear();
|
||||||
currentPageLines.clear();
|
currentPageLines.clear();
|
||||||
|
|||||||
@@ -220,10 +220,7 @@ void WeatherActivity::onExit() {
|
|||||||
Activity::onExit();
|
Activity::onExit();
|
||||||
|
|
||||||
// Weather screen is always landscape; restore app UI to portrait on exit.
|
// Weather screen is always landscape; restore app UI to portrait on exit.
|
||||||
{
|
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
||||||
RenderLock lock(*this);
|
|
||||||
renderer.setOrientation(GfxRenderer::Orientation::Portrait);
|
|
||||||
}
|
|
||||||
|
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user