Something went wrong. Try again.
A fork of https://github.com/crosspoint-reader/crosspoint-reader
Something went wrong. Try again.
2.1 kB · 56 lines
C
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#pragma once#include <Epub.h>
#include <memory>#include <string>#include <vector>
#include "../../BookmarkEntry.h"#include "activities/UiListActivity.h"#include "components/OptionPopup.h"
class EpubReaderBookmarksActivity final : public UiListActivity { // The list rides the UiListActivity scaffold (themed rows, touch routing); // the title keeps its legacy draw, and OptionPopup keeps its legacy overlay // rendering for the delete confirmation. std::shared_ptr<Epub> epub; std::string epubPath; std::vector<BookmarkEntry> bookmarks; // Row buffers derived from `bookmarks`, rebuilt only when it changes // (onEnter() load, post-delete) instead of on every repaint — buildScreen() // used to re-compose a percentage/chapter/TOC-title subtitle string per // bookmark on every render (cursor move, tap flash, ...). std::vector<std::string> bookmarkSubtitles; std::vector<freeink::ui::ListItem> bookmarkRowItems; void rebuildBookmarkRowItems(); bool confirmingDelete = false; OptionPopup confirmPopup;
public: explicit EpubReaderBookmarksActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::shared_ptr<Epub>& epub, const std::string& epubPath); void onEnter() override; void render(RenderLock&&) override;
private: int listCount() const override { return static_cast<int>(bookmarks.size()); } void buildScreen(UiScreen& screen) override; void activateIndex(int index) override; void onRowLongPress(int index) override; // Popup handling runs before everything else each pass. bool handleCustomInput() override; // Back cancels with a result; Confirm opens on release and a hold shows actions. bool handleButtons() override;
// Open the selected bookmark: finishes with a ProgressChangeResult for the reader. void openSelectedBookmark();
void startRename(); void showBookmarkActions();
// Opens the Cancel/Delete confirmation for the selected bookmark. void showDeleteConfirmation();
// Delete the currently selected bookmark and persist the list void deleteSelectedBookmark();};