feat: revert to single press to chapters and long press to menu

This commit is contained in:
GenesiaW 2026-01-19 18:33:01 +08:00
parent 1300664c87
commit 11b6a501d4
2 changed files with 27 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include "CrossPointSettings.h"
#include "CrossPointState.h"
#include "EpubReaderChapterSelectionActivity.h"
#include "EpubReaderMenuActivity.h"
#include "MappedInputManager.h"
#include "ScreenComponents.h"
@ -114,8 +115,8 @@ void EpubReaderActivity::loop() {
return;
}
// Enter chapter selection activity
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
// Enter shortcut menu activity
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() >= skipChapterMs) {
// Don't start activity transition while rendering
xSemaphoreTake(renderingMutex, portMAX_DELAY);
exitActivity();
@ -139,6 +140,30 @@ void EpubReaderActivity::loop() {
updateRequired = true;
}));
xSemaphoreGive(renderingMutex);
return;
}
// Enter chapter selection activity
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
xSemaphoreTake(renderingMutex, portMAX_DELAY);
exitActivity();
enterNewActivity(new EpubReaderChapterSelectionActivity(
this->renderer, this->mappedInput, epub, currentSpineIndex,
[this] {
exitActivity();
updateRequired = true;
},
[this](const int newSpineIndex) {
if (currentSpineIndex != newSpineIndex) {
currentSpineIndex = newSpineIndex;
nextPageNumber = 0;
section.reset();
}
exitActivity();
updateRequired = true;
}));
xSemaphoreGive(renderingMutex);
return;
}
// Long press BACK (1s+) goes directly to home

View File

@ -16,7 +16,6 @@ class EpubReaderMenuActivity final : public ActivityWithSubactivity {
SemaphoreHandle_t renderingMutex = nullptr;
int currentSpineIndex = 0;
int selectedItemIndex = 0;
int nextPageNumber = 0;
bool updateRequired = false;
const std::function<void()> onGoBack;