## 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**_
28 lines
867 B
C++
28 lines
867 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;
|
|
|
|
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);
|
|
};
|