Merge pull request #216 from jpirnay/fix-buttonnavig

fix: button navigation in lists
This commit is contained in:
jpirnay
2026-05-14 20:28:31 +02:00
committed by GitHub
8 changed files with 44 additions and 49 deletions
@@ -64,18 +64,6 @@ void EpubReaderChapterSelectionActivity::loop() {
finish();
return;
}
if ((ev.button == MappedInputManager::Button::PageBack || ev.button == MappedInputManager::Button::Left) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::previousIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
if ((ev.button == MappedInputManager::Button::PageForward || ev.button == MappedInputManager::Button::Right) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::nextIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
}
buttonNavigator.onNextList(selectorIndex, totalItems, [this] { requestUpdate(); });
@@ -55,20 +55,6 @@ void MdReaderTocSelectionActivity::loop() {
finish();
return;
}
if ((ev.button == MappedInputManager::Button::PageBack || ev.button == MappedInputManager::Button::Left) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::previousIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
if ((ev.button == MappedInputManager::Button::PageForward || ev.button == MappedInputManager::Button::Right) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::nextIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
}
buttonNavigator.onNextList(selectorIndex, totalItems, [this] { requestUpdate(); });
+11 -6
View File
@@ -115,16 +115,21 @@ inline PageTurnResult detectPageTurn(const MappedInputManager& input) {
}
const bool prevButtonReleased = (SETTINGS.btnShortPageBack == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageBack) &&
!globalButtonEvents().wasLongPressDispatched(MappedInputManager::Button::PageBack) &&
input.wasReleased(MappedInputManager::Button::PageBack)) ||
(SETTINGS.btnShortLeft == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Left) &&
!globalButtonEvents().wasLongPressDispatched(MappedInputManager::Button::Left) &&
input.wasReleased(MappedInputManager::Button::Left));
const bool nextButtonReleased = (SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
input.wasReleased(MappedInputManager::Button::PageForward)) ||
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
input.wasReleased(MappedInputManager::Button::Right));
const bool nextButtonReleased =
(SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
!globalButtonEvents().wasLongPressDispatched(MappedInputManager::Button::PageForward) &&
input.wasReleased(MappedInputManager::Button::PageForward)) ||
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
!globalButtonEvents().wasLongPressDispatched(MappedInputManager::Button::Right) &&
input.wasReleased(MappedInputManager::Button::Right));
const bool prev = tiltPrev || prevButtonReleased;
const bool next = tiltNext || nextButtonReleased;
@@ -71,18 +71,6 @@ void XtcReaderChapterSelectionActivity::loop() {
finish();
return;
}
if ((ev.button == MappedInputManager::Button::PageBack || ev.button == MappedInputManager::Button::Left) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::previousIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
if ((ev.button == MappedInputManager::Button::PageForward || ev.button == MappedInputManager::Button::Right) &&
ev.type == ButtonEventManager::PressType::Short) {
selectorIndex = ButtonNavigator::nextIndex(selectorIndex, totalItems);
requestUpdate();
return;
}
}
buttonNavigator.onNextList(selectorIndex, totalItems, [this] { requestUpdate(); });