Add UI support for darkness levels

This commit is contained in:
jpirnay
2026-04-08 19:24:17 +02:00
parent 019dde09e1
commit 72a2a91550
15 changed files with 257 additions and 82 deletions
@@ -16,6 +16,7 @@ class EpubReaderMenuActivity final : public Activity {
FOOTNOTES,
EMBEDDED_STYLE,
IMAGE_RENDERING,
TEXT_DARKNESS,
GO_TO_PERCENT,
AUTO_PAGE_TURN,
ROTATE_SCREEN,
@@ -30,8 +31,8 @@ class EpubReaderMenuActivity final : public Activity {
explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& title,
const int currentPage, const int totalPages, const int bookProgressPercent,
const uint8_t currentOrientation, const bool hasFootnotes,
const int8_t initialEmbeddedStyleOverride,
const int8_t initialImageRenderingOverride);
const int8_t initialEmbeddedStyleOverride, const int8_t initialImageRenderingOverride,
const uint8_t initialTextDarkness);
void onEnter() override;
void onExit() override;
@@ -57,8 +58,11 @@ class EpubReaderMenuActivity final : public Activity {
uint8_t selectedPageTurnOption = 0;
int8_t pendingEmbeddedStyleOverride = -1;
int8_t pendingImageRenderingOverride = -1;
uint8_t pendingTextDarkness = 1;
const std::vector<StrId> orientationLabels = {StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED,
StrId::STR_LANDSCAPE_CCW};
const std::vector<StrId> textDarknessLabels = {StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK,
StrId::STR_MAX_DARK};
const std::vector<StrId> imageRenderingLabels = {StrId::STR_IMAGES_DISPLAY, StrId::STR_IMAGES_PLACEHOLDER,
StrId::STR_IMAGES_SUPPRESS};
const std::vector<const char*> pageTurnLabels = {I18N.get(StrId::STR_STATE_OFF), "1", "3", "6", "12"};