feat: add power button short press for quick access to footnotes (#1658)

This commit is contained in:
Lorenzo Santini authored and GitHub committed 2026-06-08 14:45:41 -04:00
1 parent 7f01eab62e
commit 9c12b90737
8 files changed
+63 -7

No files matched your search

@@ -312,6 +312,32 @@ void EpubReaderActivity::loop() {
return;
}
// auto [prevTriggered, nextTriggered] = ReaderUtils::detectPageTurn(mappedInput);
// Handle short power button press for footnotes
if (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::FOOTNOTES &&
mappedInput.wasReleased(MappedInputManager::Button::Power) &&
!mappedInput.wasReleased(MappedInputManager::Button::Down)) {
if (footnoteDepth > 0) {
restoreSavedPosition();
} else {
if (currentPageFootnotes.size() == 1) {
navigateToHref(currentPageFootnotes[0].href, true);
} else if (currentPageFootnotes.size() > 1) {
startActivityForResult(
std::make_unique<EpubReaderFootnotesActivity>(renderer, mappedInput, currentPageFootnotes),
[this](const ActivityResult& result) {
if (!result.isCancelled) {
const auto& footnoteResult = std::get<FootnoteResult>(result.data);
navigateToHref(footnoteResult.href, true);
}
requestUpdate();
});
}
}
return;
}
const auto [prevTriggered, nextTriggered, fromTilt] = ReaderUtils::detectPageTurn(mappedInput);
if (!prevTriggered && !nextTriggered) {
return;
@@ -26,7 +26,8 @@ void EpubReaderFootnotesActivity::loop() {
return;
}
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm) ||
mappedInput.wasReleased(MappedInputManager::Button::Power)) {
if (selectedIndex >= 0 && selectedIndex < static_cast<int>(footnotes.size())) {
setResult(FootnoteResult{footnotes[selectedIndex].href});
finish();