Merge pull request #177 from jpirnay/refactor-pr1838
refactor: Simplify isReaderActivity bookkeeping (upstream pr1838)
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <esp_heap_caps.h>
|
||||
#include <esp_system.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "CrossPointState.h"
|
||||
#include "OpdsServerStore.h"
|
||||
#include "SdCardFontGlobals.h"
|
||||
@@ -390,7 +392,11 @@ void ActivityManager::popActivity() {
|
||||
|
||||
bool ActivityManager::preventAutoSleep() const { return currentActivity && currentActivity->preventAutoSleep(); }
|
||||
|
||||
bool ActivityManager::isReaderActivity() const { return currentActivity && currentActivity->isReaderActivity(); }
|
||||
bool ActivityManager::isReaderActivity() const {
|
||||
if (currentActivity && currentActivity->isReaderActivity()) return true;
|
||||
return std::any_of(stackActivities.begin(), stackActivities.end(),
|
||||
[](const auto& activity) { return activity->isReaderActivity(); });
|
||||
}
|
||||
|
||||
bool ActivityManager::skipLoopDelay() const { return currentActivity && currentActivity->skipLoopDelay(); }
|
||||
|
||||
|
||||
@@ -203,7 +203,6 @@ class EpubReaderActivity final : public Activity {
|
||||
void onExit() override;
|
||||
void loop() override;
|
||||
void render(RenderLock&& lock) override;
|
||||
bool isReaderActivity() const override { return true; }
|
||||
void onButtonAction(CrossPointSettings::BUTTON_ACTION action) override;
|
||||
|
||||
// Renders the last saved page to the frame buffer without flushing to display.
|
||||
|
||||
@@ -23,5 +23,4 @@ class XtcReaderChapterSelectionActivity final : public Activity {
|
||||
void onExit() override;
|
||||
void loop() override;
|
||||
void render(RenderLock&&) override;
|
||||
bool isReaderActivity() const override { return true; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user