mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-08 08:37:38 +03:00
Compare commits
No commits in common. "3664355b1ad8d0084af4aff9f5993e78c2be72ea" and "344f675233548c3e74c96a970c1d2627b2ac3440" have entirely different histories.
3664355b1a
...
344f675233
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "CrossPointSettings.h"
|
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
|
#include "CrossPointSettings.h"
|
||||||
#include "RecentBooksStore.h"
|
#include "RecentBooksStore.h"
|
||||||
#include "ScreenComponents.h"
|
#include "ScreenComponents.h"
|
||||||
#include "fontIds.h"
|
#include "fontIds.h"
|
||||||
|
|||||||
@ -162,7 +162,7 @@ void EpubReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect long-press and schedule skip immediately
|
// Detect long-press and schedule skip immediately
|
||||||
const bool prevPressed = mappedInput.isPressed(MappedInputManager::Button::PageBack) ||
|
const bool prevPressed = mappedInput.isPressed(MappedInputManager::Button::PageBack) ||
|
||||||
mappedInput.isPressed(MappedInputManager::Button::Left);
|
mappedInput.isPressed(MappedInputManager::Button::Left);
|
||||||
const bool nextPressed = mappedInput.isPressed(MappedInputManager::Button::PageForward) ||
|
const bool nextPressed = mappedInput.isPressed(MappedInputManager::Button::PageForward) ||
|
||||||
@ -179,7 +179,7 @@ void EpubReaderActivity::loop() {
|
|||||||
delayedSkipDir = nextPressed ? +1 : -1;
|
delayedSkipDir = nextPressed ? +1 : -1;
|
||||||
delayedSkipExecuteAtMs = millis() + 500;
|
delayedSkipExecuteAtMs = millis() + 500;
|
||||||
xSemaphoreGive(renderingMutex);
|
xSemaphoreGive(renderingMutex);
|
||||||
// Block changing page until unpressed skip button
|
// Block release-based page change until unpressed
|
||||||
awaitingReleaseAfterSkip = true;
|
awaitingReleaseAfterSkip = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -201,10 +201,6 @@ void EpubReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delayedSkipPending) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// any botton press when at end of the book goes back to the last page
|
// any botton press when at end of the book goes back to the last page
|
||||||
if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) {
|
if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) {
|
||||||
currentSpineIndex = epub->getSpineItemsCount() - 1;
|
currentSpineIndex = epub->getSpineItemsCount() - 1;
|
||||||
@ -213,6 +209,7 @@ void EpubReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// No current section, attempt to rerender the book
|
// No current section, attempt to rerender the book
|
||||||
if (!section) {
|
if (!section) {
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
@ -255,6 +252,7 @@ void EpubReaderActivity::displayTaskLoop() {
|
|||||||
renderScreen();
|
renderScreen();
|
||||||
xSemaphoreGive(renderingMutex);
|
xSemaphoreGive(renderingMutex);
|
||||||
} else if (delayedSkipPending && now >= delayedSkipExecuteAtMs) {
|
} else if (delayedSkipPending && now >= delayedSkipExecuteAtMs) {
|
||||||
|
// Execute the delayed chapter skip now
|
||||||
xSemaphoreTake(renderingMutex, portMAX_DELAY);
|
xSemaphoreTake(renderingMutex, portMAX_DELAY);
|
||||||
nextPageNumber = 0;
|
nextPageNumber = 0;
|
||||||
currentSpineIndex += delayedSkipDir;
|
currentSpineIndex += delayedSkipDir;
|
||||||
|
|||||||
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
#include <GfxRenderer.h>
|
#include <GfxRenderer.h>
|
||||||
|
|
||||||
#include "CrossPointSettings.h"
|
|
||||||
#include "KOReaderCredentialStore.h"
|
#include "KOReaderCredentialStore.h"
|
||||||
#include "KOReaderSyncActivity.h"
|
#include "KOReaderSyncActivity.h"
|
||||||
|
#include "CrossPointSettings.h"
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
#include "fontIds.h"
|
#include "fontIds.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
} // namespace
|
||||||
|
|
||||||
bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); }
|
bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); }
|
||||||
|
|
||||||
int EpubReaderChapterSelectionActivity::getTotalItems() const {
|
int EpubReaderChapterSelectionActivity::getTotalItems() const {
|
||||||
|
|||||||
@ -110,7 +110,7 @@ void XtcReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect long-press and schedule skip immediately
|
// Detect long-press and schedule skip immediately
|
||||||
const bool prevPressed = mappedInput.isPressed(MappedInputManager::Button::PageBack) ||
|
const bool prevPressed = mappedInput.isPressed(MappedInputManager::Button::PageBack) ||
|
||||||
mappedInput.isPressed(MappedInputManager::Button::Left);
|
mappedInput.isPressed(MappedInputManager::Button::Left);
|
||||||
const bool nextPressed = mappedInput.isPressed(MappedInputManager::Button::PageForward) ||
|
const bool nextPressed = mappedInput.isPressed(MappedInputManager::Button::PageForward) ||
|
||||||
@ -128,7 +128,7 @@ void XtcReaderActivity::loop() {
|
|||||||
delayedSkipAmount = 10; // long-press skip amount
|
delayedSkipAmount = 10; // long-press skip amount
|
||||||
delayedSkipExecuteAtMs = millis() + 500;
|
delayedSkipExecuteAtMs = millis() + 500;
|
||||||
xSemaphoreGive(renderingMutex);
|
xSemaphoreGive(renderingMutex);
|
||||||
// Block changing page until unpressed skip button
|
// Block release-based page change until unpressed
|
||||||
awaitingReleaseAfterSkip = true;
|
awaitingReleaseAfterSkip = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -150,10 +150,6 @@ void XtcReaderActivity::loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delayedSkipPending) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle end of book
|
// Handle end of book
|
||||||
if (currentPage >= xtc->getPageCount()) {
|
if (currentPage >= xtc->getPageCount()) {
|
||||||
currentPage = xtc->getPageCount() - 1;
|
currentPage = xtc->getPageCount() - 1;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class XtcReaderActivity final : public ActivityWithSubactivity {
|
|||||||
bool delayedSkipPending = false;
|
bool delayedSkipPending = false;
|
||||||
int delayedSkipDir = 0;
|
int delayedSkipDir = 0;
|
||||||
uint32_t delayedSkipExecuteAtMs = 0;
|
uint32_t delayedSkipExecuteAtMs = 0;
|
||||||
uint32_t delayedSkipAmount = 0;
|
uint32_t delayedSkipAmount = 0;
|
||||||
bool awaitingReleaseAfterSkip = false;
|
bool awaitingReleaseAfterSkip = false;
|
||||||
bool skipUnpressed = false;
|
bool skipUnpressed = false;
|
||||||
const std::function<void()> onGoBack;
|
const std::function<void()> onGoBack;
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
#include "fontIds.h"
|
#include "fontIds.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
} // namespace
|
||||||
|
|
||||||
int XtcReaderChapterSelectionActivity::getPageItems() const {
|
int XtcReaderChapterSelectionActivity::getPageItems() const {
|
||||||
constexpr int startY = 60;
|
constexpr int startY = 60;
|
||||||
constexpr int lineHeight = 30;
|
constexpr int lineHeight = 30;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const SettingInfo controlsSettings[controlsSettingsCount] = {
|
|||||||
SettingInfo::Enum("Side Button Layout (reader)", &CrossPointSettings::sideButtonLayout,
|
SettingInfo::Enum("Side Button Layout (reader)", &CrossPointSettings::sideButtonLayout,
|
||||||
{"Prev, Next", "Next, Prev"}),
|
{"Prev, Next", "Next, Prev"}),
|
||||||
SettingInfo::Toggle("Long-press Chapter Skip", &CrossPointSettings::longPressChapterSkip),
|
SettingInfo::Toggle("Long-press Chapter Skip", &CrossPointSettings::longPressChapterSkip),
|
||||||
SettingInfo::Enum("Long-press Duration", &CrossPointSettings::longPressDuration, {"1s", "2s", "3s", "5s", "10s"}),
|
SettingInfo::Enum("Long-press Duration", &CrossPointSettings::longPressDuration, {"1s", "2s", "3s", "5s", "10s"}),
|
||||||
SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, {"Ignore", "Sleep", "Page Turn"})};
|
SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, {"Ignore", "Sleep", "Page Turn"})};
|
||||||
|
|
||||||
constexpr int systemSettingsCount = 5;
|
constexpr int systemSettingsCount = 5;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user