fix(ui): Add Back label in KOReader Sync screen (#770)

## Summary

- Remove duplicate Cancel option 
- Add Back label

<img width="435" height="613" alt="image"
src="https://github.com/user-attachments/assets/a3af4133-46fa-46e6-8360-a15dd7c4fe2a"
/>


## Result

<img width="575" height="431" alt="image"
src="https://github.com/user-attachments/assets/6ccdac89-43df-45bf-bcfa-3a7cc4bd88e4"
/>


---

### AI Usage

Did you use AI tools to help write this code? _**< PARTIALLY >**_

Closes #754
This commit is contained in:
Yaroslav
2026-02-08 23:51:51 +03:00
committed by GitHub
parent 71769490fb
commit f34d7d2aac
2 changed files with 7 additions and 16 deletions

View File

@@ -317,7 +317,6 @@ void KOReaderSyncActivity::render() {
localProgress.percentage * 100); localProgress.percentage * 100);
renderer.drawText(UI_10_FONT_ID, 20, 320, localPageStr); renderer.drawText(UI_10_FONT_ID, 20, 320, localPageStr);
// Options
const int optionY = 350; const int optionY = 350;
const int optionHeight = 30; const int optionHeight = 30;
@@ -333,13 +332,8 @@ void KOReaderSyncActivity::render() {
} }
renderer.drawText(UI_10_FONT_ID, 20, optionY + optionHeight, "Upload local progress", selectedOption != 1); renderer.drawText(UI_10_FONT_ID, 20, optionY + optionHeight, "Upload local progress", selectedOption != 1);
// Cancel option // Bottom button hints: show Back and Select
if (selectedOption == 2) { const auto labels = mappedInput.mapLabels("Back", "Select", "", "");
renderer.fillRect(0, optionY + optionHeight * 2 - 2, pageWidth - 1, optionHeight);
}
renderer.drawText(UI_10_FONT_ID, 20, optionY + optionHeight * 2, "Cancel", selectedOption != 2);
const auto labels = mappedInput.mapLabels("", "Select", "", "");
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
renderer.displayBuffer(); renderer.displayBuffer();
return; return;
@@ -349,7 +343,7 @@ void KOReaderSyncActivity::render() {
renderer.drawCenteredText(UI_10_FONT_ID, 280, "No remote progress found", true, EpdFontFamily::BOLD); renderer.drawCenteredText(UI_10_FONT_ID, 280, "No remote progress found", true, EpdFontFamily::BOLD);
renderer.drawCenteredText(UI_10_FONT_ID, 320, "Upload current position?"); renderer.drawCenteredText(UI_10_FONT_ID, 320, "Upload current position?");
const auto labels = mappedInput.mapLabels("Cancel", "Upload", "", ""); const auto labels = mappedInput.mapLabels("Back", "Upload", "", "");
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
renderer.displayBuffer(); renderer.displayBuffer();
return; return;
@@ -392,11 +386,11 @@ void KOReaderSyncActivity::loop() {
// Navigate options // Navigate options
if (mappedInput.wasPressed(MappedInputManager::Button::Up) || if (mappedInput.wasPressed(MappedInputManager::Button::Up) ||
mappedInput.wasPressed(MappedInputManager::Button::Left)) { mappedInput.wasPressed(MappedInputManager::Button::Left)) {
selectedOption = (selectedOption + 2) % 3; // Wrap around selectedOption = (selectedOption + 1) % 2; // Wrap around among 2 options
updateRequired = true; updateRequired = true;
} else if (mappedInput.wasPressed(MappedInputManager::Button::Down) || } else if (mappedInput.wasPressed(MappedInputManager::Button::Down) ||
mappedInput.wasPressed(MappedInputManager::Button::Right)) { mappedInput.wasPressed(MappedInputManager::Button::Right)) {
selectedOption = (selectedOption + 1) % 3; selectedOption = (selectedOption + 1) % 2; // Wrap around among 2 options
updateRequired = true; updateRequired = true;
} }
@@ -407,9 +401,6 @@ void KOReaderSyncActivity::loop() {
} else if (selectedOption == 1) { } else if (selectedOption == 1) {
// Upload local progress // Upload local progress
performUpload(); performUpload();
} else {
// Cancel
onCancel();
} }
} }

View File

@@ -18,7 +18,7 @@
* 1. Connect to WiFi (if not connected) * 1. Connect to WiFi (if not connected)
* 2. Calculate document hash * 2. Calculate document hash
* 3. Fetch remote progress * 3. Fetch remote progress
* 4. Show comparison and options (Apply/Upload/Cancel) * 4. Show comparison and options (Apply/Upload)
* 5. Apply or upload progress * 5. Apply or upload progress
*/ */
class KOReaderSyncActivity final : public ActivityWithSubactivity { class KOReaderSyncActivity final : public ActivityWithSubactivity {
@@ -82,7 +82,7 @@ class KOReaderSyncActivity final : public ActivityWithSubactivity {
// Local progress as KOReader format (for display) // Local progress as KOReader format (for display)
KOReaderPosition localProgress; KOReaderPosition localProgress;
// Selection in result screen (0=Apply, 1=Upload, 2=Cancel) // Selection in result screen (0=Apply, 1=Upload)
int selectedOption = 0; int selectedOption = 0;
OnCancelCallback onCancel; OnCancelCallback onCancel;