Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch: Activities (migrated to new ActivityManager pattern): - Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity - Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity, DictionaryWordSelectActivity, LookedUpWordsActivity - Bookmark: EpubReaderBookmarkSelectionActivity - Book management: BookManageMenuActivity, EndOfBookMenuActivity - OPDS: OpdsServerListActivity, OpdsSettingsActivity - Utility: DirectoryPickerActivity, NumericStepperActivity Utilities (unchanged): - BookManager, BookSettings, BookmarkStore, BootNtpSync - Dictionary, LookupHistory, TimeSync, OpdsServerStore Libraries: PlaceholderCover, TableData, ChapterXPathIndexer Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover Docs: KOReader sync XPath mapping Migration changes: - ActivityWithSubactivity -> Activity base class - Callback constructors -> finish()/setResult() pattern - enterNewActivity() -> startActivityForResult() - Activity::RenderLock&& -> RenderLock&& These files won't compile yet - they reference mod settings and I18n strings that will be added in subsequent phases. Made-with: Cursor
38 lines
2.0 KiB
Markdown
38 lines
2.0 KiB
Markdown
# Long-Press Confirm to Open Table of Contents
|
|
|
|
**Date**: 2026-02-17
|
|
**Branch**: mod/improve-home-screen
|
|
|
|
## Task
|
|
|
|
Add long-press detection on the Confirm button while reading an EPUB to directly open the Table of Contents (chapter selection), bypassing the reader menu. Short press retains existing behavior (opens menu).
|
|
|
|
## Changes Made
|
|
|
|
### `src/activities/reader/EpubReaderActivity.h`
|
|
- Added `bool ignoreNextConfirmRelease` member to suppress short-press after a long-press Confirm
|
|
- Added `void openChapterSelection()` private method declaration
|
|
|
|
### `src/activities/reader/EpubReaderActivity.cpp`
|
|
- Added `constexpr unsigned long longPressConfirmMs = 700` threshold constant
|
|
- Extracted `openChapterSelection()` helper method from the duplicated `EpubReaderChapterSelectionActivity` construction code
|
|
- Added long-press Confirm detection in `loop()` (before the existing short-press check): opens TOC directly if `epub->getTocItemsCount() > 0`
|
|
- Refactored `onReaderMenuConfirm(SELECT_CHAPTER)` to use the new helper (was ~35 lines of inline construction)
|
|
- Refactored `onReaderMenuConfirm(GO_TO_BOOKMARK)` fallback (no bookmarks + TOC available) to use the same helper
|
|
- Reset `ignoreNextConfirmRelease` when `skipNextButtonCheck` clears, to avoid stale state across subactivity transitions
|
|
|
|
### `src/activities/reader/EpubReaderChapterSelectionActivity.h`
|
|
- Added `bool ignoreNextConfirmRelease` member
|
|
- Added `initialSkipRelease` constructor parameter (default `false`) to consume stale Confirm release when opened via long-press
|
|
|
|
### `src/activities/reader/EpubReaderChapterSelectionActivity.cpp`
|
|
- Added guard in `loop()` to skip the first Confirm release when `ignoreNextConfirmRelease` is true
|
|
|
|
## Pattern Used
|
|
|
|
Follows the existing Back button short/long-press pattern: `isPressed() + getHeldTime() >= threshold` for long press, `wasReleased()` for short press, with `ignoreNextConfirmRelease` flag (same pattern as `EpubReaderMenuActivity`, `LookedUpWordsActivity`, and other activities).
|
|
|
|
## Follow-up Items
|
|
|
|
- None identified
|