Files
Crosspoint/src/activities/reader/EpubReaderChapterSelectionActivity.h
T
Zach Nelson 395e68ea2b refactor: Simplify isReaderActivity bookkeeping (#1838)
## Summary

Before, any sub-activity of a reader activity needed to override
`isReaderActivity` to maintain correct bookkeeping through
`ActivityManager::isReaderActivity`. We could easily miss this in any
new sub-activities. Instead, simplify so each reader activity correctly
reports and then `ActivityManager` checks for any reader activity in its
stack.

---

### 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? _**NO**_
2026-05-06 09:57:22 -05:00

36 lines
1.1 KiB
C++

#pragma once
#include <Epub.h>
#include <memory>
#include "../Activity.h"
#include "util/ButtonNavigator.h"
class EpubReaderChapterSelectionActivity final : public Activity {
std::shared_ptr<Epub> epub;
std::string epubPath;
ButtonNavigator buttonNavigator;
int currentSpineIndex = 0;
int selectorIndex = 0;
// Number of items that fit on a page, derived from logical screen height.
// This adapts automatically when switching between portrait and landscape.
int getPageItems() const;
// Total TOC items count
int getTotalItems() const;
public:
explicit EpubReaderChapterSelectionActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
const std::shared_ptr<Epub>& epub, const std::string& epubPath,
const int currentSpineIndex)
: Activity("EpubReaderChapterSelection", renderer, mappedInput),
epub(epub),
epubPath(epubPath),
currentSpineIndex(currentSpineIndex) {}
void onEnter() override;
void onExit() override;
void loop() override;
void render(RenderLock&&) override;
};