fix: small QoL: return to the last selected menu location (#1629)
## Summary * **What is the goal of this PR?** Small UX improvement to the Home screen by preserving the last selected cursor position when returning to it. It supersedes #985 and #1103, which are both significantly outdated and hundreds of commits behind master. --- ### AI Usage Did you use AI tools to help write this code? _**< YES >**_
This commit is contained in:
@@ -207,10 +207,25 @@ void ActivityManager::goToFullScreenMessage(std::string message, EpdFontFamily::
|
||||
replaceActivity(std::make_unique<FullScreenMessageActivity>(renderer, mappedInput, std::move(message), style));
|
||||
}
|
||||
|
||||
void ActivityManager::goHome(HomeMenuItem initialMenuItem) {
|
||||
if (initialMenuItem == HomeMenuItem::NONE && currentActivity) {
|
||||
const auto& activityName = currentActivity->name;
|
||||
if (activityName == "FileBrowser") {
|
||||
initialMenuItem = HomeMenuItem::FILE_BROWSER;
|
||||
} else if (activityName == "RecentBooks") {
|
||||
initialMenuItem = HomeMenuItem::RECENTS;
|
||||
} else if (activityName == "OpdsBookBrowser") {
|
||||
initialMenuItem = HomeMenuItem::OPDS_BROWSER;
|
||||
} else if (activityName == "CrossPointWebServer") {
|
||||
initialMenuItem = HomeMenuItem::FILE_TRANSFER;
|
||||
} else if (activityName == "Settings") {
|
||||
initialMenuItem = HomeMenuItem::SETTINGS_MENU;
|
||||
}
|
||||
}
|
||||
replaceActivity(std::make_unique<HomeActivity>(renderer, mappedInput, initialMenuItem));
|
||||
}
|
||||
void ActivityManager::goToCrashReport() { replaceActivity(std::make_unique<CrashActivity>(renderer, mappedInput)); }
|
||||
|
||||
void ActivityManager::goHome() { replaceActivity(std::make_unique<HomeActivity>(renderer, mappedInput)); }
|
||||
|
||||
void ActivityManager::pushActivity(std::unique_ptr<Activity>&& activity) {
|
||||
if (pendingActivity) {
|
||||
// Should never happen in practice
|
||||
|
||||
Reference in New Issue
Block a user