Add orientation change to button actions
This commit is contained in:
@@ -290,6 +290,7 @@ class CrossPointSettings {
|
||||
BTN_TOGGLE_BIONIC_READING,
|
||||
BTN_KOREADER_SYNC,
|
||||
BTN_CYCLE_FONT_SIZE,
|
||||
BTN_CYCLE_ORIENTATION,
|
||||
BUTTON_ACTION_COUNT
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ inline const std::vector<SettingInfo> list = {
|
||||
StrId::STR_BTN_ACT_OPEN_BOOKMARKS, StrId::STR_BTN_ACT_STAR_PAGE, StrId::STR_BTN_ACT_FOOTNOTES, \
|
||||
StrId::STR_BTN_ACT_NEXT_SECTION, StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, \
|
||||
StrId::STR_BTN_ACT_READER_MENU, StrId::STR_BTN_ACT_TOGGLE_BIONIC_READING, StrId::STR_BTN_ACT_KOREADER_SYNC, \
|
||||
StrId::STR_BTN_ACT_CYCLE_FONT_SIZE
|
||||
StrId::STR_BTN_ACT_CYCLE_FONT_SIZE, StrId::STR_BTN_ACT_CYCLE_ORIENTATION
|
||||
|
||||
// Back button: short=exit reader, double=ignore, long=go home
|
||||
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, {StrId::STR_BTN_DEF_EXIT_READER},
|
||||
|
||||
@@ -2016,6 +2016,14 @@ void EpubReaderActivity::onButtonAction(const CrossPointSettings::BUTTON_ACTION
|
||||
requestUpdate();
|
||||
}
|
||||
break;
|
||||
case BA::BTN_CYCLE_ORIENTATION:
|
||||
if (epub) {
|
||||
const uint8_t nextOrientation =
|
||||
static_cast<uint8_t>((SETTINGS.orientation + 1) % CrossPointSettings::ORIENTATION_COUNT);
|
||||
applyOrientation(nextOrientation);
|
||||
requestUpdate();
|
||||
}
|
||||
break;
|
||||
case BA::BTN_KOREADER_SYNC:
|
||||
launchKOReaderSync(SyncLaunchMode::COMPARE);
|
||||
break;
|
||||
|
||||
@@ -995,6 +995,15 @@ void MdReaderActivity::onButtonAction(const CrossPointSettings::BUTTON_ACTION ac
|
||||
ReaderUtils::enforceExitFullRefresh(renderer);
|
||||
finish();
|
||||
break;
|
||||
case BA::BTN_CYCLE_ORIENTATION: {
|
||||
const uint8_t nextOrientation =
|
||||
static_cast<uint8_t>((SETTINGS.orientation + 1) % CrossPointSettings::ORIENTATION_COUNT);
|
||||
SETTINGS.orientation = nextOrientation;
|
||||
SETTINGS.saveToFile();
|
||||
ReaderUtils::applyOrientation(renderer, SETTINGS.orientation);
|
||||
requestUpdate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -833,6 +833,15 @@ void TxtReaderActivity::onButtonAction(const CrossPointSettings::BUTTON_ACTION a
|
||||
ReaderUtils::enforceExitFullRefresh(renderer);
|
||||
finish();
|
||||
break;
|
||||
case BA::BTN_CYCLE_ORIENTATION: {
|
||||
const uint8_t nextOrientation =
|
||||
static_cast<uint8_t>((SETTINGS.orientation + 1) % CrossPointSettings::ORIENTATION_COUNT);
|
||||
SETTINGS.orientation = nextOrientation;
|
||||
SETTINGS.saveToFile();
|
||||
ReaderUtils::applyOrientation(renderer, SETTINGS.orientation);
|
||||
requestUpdate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -545,6 +545,9 @@ void loop() {
|
||||
case BA::BTN_CYCLE_FONT_SIZE:
|
||||
activityManager.dispatchButtonAction(BA::BTN_CYCLE_FONT_SIZE);
|
||||
break;
|
||||
case BA::BTN_CYCLE_ORIENTATION:
|
||||
activityManager.dispatchButtonAction(BA::BTN_CYCLE_ORIENTATION);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user