feat: add EndOfBookMenuActivity replacing static end-of-book text

Interactive menu shown when reaching the end of a book with options:
Archive Book, Delete Book, Back to Beginning, Close Book, Close Menu.
Wired into EpubReaderActivity, XtcReaderActivity, and TxtReaderActivity
(TXT shows menu when user tries to advance past the last page).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cottongin
2026-02-21 03:04:48 -05:00
parent f5b708424d
commit 98146f2545
8 changed files with 253 additions and 9 deletions

View File

@@ -0,0 +1,46 @@
#pragma once
#include <I18n.h>
#include <functional>
#include <string>
#include <vector>
#include "../Activity.h"
#include "util/ButtonNavigator.h"
class EndOfBookMenuActivity final : public Activity {
public:
enum class Action {
ARCHIVE,
DELETE,
BACK_TO_BEGINNING,
CLOSE_BOOK,
CLOSE_MENU,
};
explicit EndOfBookMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& bookPath,
const std::function<void(Action)>& onAction)
: Activity("EndOfBookMenu", renderer, mappedInput), bookPath(bookPath), onAction(onAction) {
buildMenuItems();
}
void onEnter() override;
void onExit() override;
void loop() override;
void render(Activity::RenderLock&&) override;
private:
struct MenuItem {
Action action;
StrId labelId;
};
std::string bookPath;
std::vector<MenuItem> menuItems;
int selectedIndex = 0;
ButtonNavigator buttonNavigator;
const std::function<void(Action)> onAction;
void buildMenuItems();
};