## Summary * **What is the goal of this PR?** Fixes #2402. On the X3, the "Time to Sleep" picker's 5-minute side buttons were inverted (left increased, right decreased) and the on-screen legend didn't match the physical buttons. * **What changes are included?** * Flip the large-step (±5 min) direction on X3 so the left side button decreases and the right increases, matching the layout. X4 is unchanged. * Add a device-specific step-hint string (`STR_SLEEP_TIMER_STEP_HINT_X3`) selected via `gpio.deviceIsX3()`. X3 shows `+/-: 1 min Side buttons: 5 min`; X4 keeps the original `Left/Right: 1 min Up/Down: 5 min`. * Same fix applied to both slider pickers that read the raw up/down side buttons: the Time-to-Sleep picker and the "Go to %" picker (`EpubReaderPercentSelectionActivity`), each with its own X3 hint string (`STR_SLEEP_TIMER_STEP_HINT_X3`, `STR_PERCENT_STEP_HINT_X3`). ## Additional Context * **Root cause:** the X3's side buttons sit one on each edge of the screen (power on top), whereas the X4 has a vertical up/down rocker on the right edge. So `BTN_UP` is physically the *left* button on X3 but the *top* button on X4. The picker mapped up→+5 / down→−5 unconditionally, which reads naturally on the X4 rocker but inverted on the X3's left/right buttons. The static legend ("Up/Down: 5 min") had the same X3-only mismatch. * The codebase already detects the device at runtime and handles this layout difference elsewhere (e.g. `LyraTheme::drawSideButtonHints` draws "Up on left, Down on right" for X3), so this reuses the same `gpio.deviceIsX3()` signal. * Swept the codebase for other side-button sliders: `ClockOffsetActivity` already uses the `Next/Previous` (`ButtonNavigator`) abstraction, which resolves to left=decrement / right=increment on X3, so it needs no change. List/page navigation (Wi-Fi, KOReader sync, BMP viewer) and the keyboard cursor are also unaffected. The two slider pickers above were the only ones using raw up/down. * **X4 is untouched** — same direction, same legend wording as before. * **Tested on X3 hardware:** left side button now decreases, right increases, and the legend matches. X4 not yet tested on device (no unit on hand); its behaviour and strings are unchanged from master. * **Translations:** the new `STR_SLEEP_TIMER_STEP_HINT_X3` and `STR_PERCENT_STEP_HINT_X3` were added to all 26 languages, but the non-English ones are AI-generated and would benefit from a native-speaker pass — particularly Hebrew (RTL ordering with a leading `+/-`), Kazakh, and Vietnamese. --- ### AI Usage Did you use AI tools to help write this code? _**YES**_ --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
52 lines
1.6 KiB
C++
52 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <I18n.h>
|
|
|
|
#include "MappedInputManager.h"
|
|
#include "activities/Activity.h"
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
class GfxRenderer;
|
|
|
|
class IntervalSelectionActivity final : public Activity {
|
|
public:
|
|
explicit IntervalSelectionActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const char* activityName,
|
|
StrId titleId, int initialValue, int minValue, int maxValue, int smallStep,
|
|
int largeStep, StrId valueFormatId = StrId::STR_NONE_OPT,
|
|
bool readerActivity = false, bool ignoreInitialConfirmRelease = false,
|
|
StrId maxBoundaryLabelId = StrId::STR_NONE_OPT)
|
|
: Activity(activityName, renderer, mappedInput),
|
|
titleId(titleId),
|
|
valueFormatId(valueFormatId),
|
|
maxBoundaryLabelId(maxBoundaryLabelId),
|
|
value(initialValue),
|
|
minValue(minValue),
|
|
maxValue(maxValue),
|
|
smallStep(smallStep),
|
|
largeStep(largeStep),
|
|
readerActivity(readerActivity),
|
|
ignoreConfirmRelease(ignoreInitialConfirmRelease) {}
|
|
|
|
void onEnter() override;
|
|
void loop() override;
|
|
void render(RenderLock&&) override;
|
|
bool isReaderActivity() const override { return readerActivity; }
|
|
|
|
private:
|
|
StrId titleId;
|
|
StrId valueFormatId;
|
|
StrId maxBoundaryLabelId;
|
|
int value;
|
|
int minValue;
|
|
int maxValue;
|
|
int smallStep;
|
|
int largeStep;
|
|
bool readerActivity;
|
|
bool ignoreConfirmRelease;
|
|
ButtonNavigator buttonNavigator;
|
|
|
|
void adjustValue(int delta);
|
|
int clampedValue(int candidate) const;
|
|
void drawStepHintLine(int y, StrId labelId, int step);
|
|
};
|