Files
Crosspoint/src/activities/reader/EpubReaderPercentSelectionActivity.h
T
Егор Мартынов cced77783f feat: add orientation-aware popups for reader activities (#1428)
## Summary

Make popups (like "Going to sleep") respect the current screen
orientation when shown from reader activities.

**What changes are included?**

- Apply reader orientation in SleepActivity before showing popup when
`lastSleepFromReader` is true
- Make popup Y-position proportional to screen height (7.5% for
BaseTheme, 16.5% for LyraTheme) instead of hardcoded pixel values,
ensuring correct positioning in both portrait and landscape modes.
- Add `isReaderActivity()` override to all reader sub-screens (menu,
chapter selection, percent selection, footnotes, QR display, KOReader
sync), so sleep popups rotate correctly when entering sleep from any
reader context.

## Additional Context

<img
src="https://github.com/user-attachments/assets/47d88c2c-ffc5-41a7-b3f2-af272ea0150e"
width="400" height="240">

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**YES**_ (Claude Opus
4.5)
2026-04-14 17:21:55 -05:00

29 lines
925 B
C++

#pragma once
#include "MappedInputManager.h"
#include "activities/Activity.h"
#include "util/ButtonNavigator.h"
class EpubReaderPercentSelectionActivity final : public Activity {
public:
// Slider-style percent selector for jumping within a book.
explicit EpubReaderPercentSelectionActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
const int initialPercent)
: Activity("EpubReaderPercentSelection", renderer, mappedInput), percent(initialPercent) {}
void onEnter() override;
void onExit() override;
void loop() override;
void render(RenderLock&&) override;
bool isReaderActivity() const override { return true; }
private:
// Current percent value (0-100) shown on the slider.
int percent = 0;
ButtonNavigator buttonNavigator;
// Change the current percent by a delta and clamp within bounds.
void adjustPercent(int delta);
};