From a2f016b2d189353b7df9784b46e308429a9af3f9 Mon Sep 17 00:00:00 2001 From: iota97 Date: Sun, 12 Sep 2021 01:17:24 +0200 Subject: [PATCH] Fix setting info on multi choice --- UI/GameSettingsScreen.cpp | 10 ++++++++++ UI/GameSettingsScreen.h | 4 ++++ UI/MiscScreens.cpp | 5 +++++ UI/MiscScreens.h | 2 ++ 4 files changed, 21 insertions(+) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index dcd18cf21c..5c3ff01a7c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -218,6 +218,11 @@ void GameSettingsScreen::CreateViews() { settingInfo_->SetBottomCutoff(dp_yres - 200.0f); root_->Add(settingInfo_); + // Show it again if we recreated the view + if (oldSettingInfo_ != "") { + settingInfo_->Show(oldSettingInfo_, nullptr); + } + // TODO: These currently point to global settings, not game specific ones. // Graphics @@ -1273,6 +1278,11 @@ void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult resul } } +void GameSettingsScreen::RecreateViews() { + oldSettingInfo_ = settingInfo_->GetText(); + UIScreen::RecreateViews(); +} + void GameSettingsScreen::CallbackMemstickFolder(bool yes) { auto sy = GetI18NCategory("System"); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 4346b948fd..9c4a8ecb91 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -44,6 +44,7 @@ protected: void CallbackMemstickFolder(bool yes); bool UseVerticalLayout() const; void dialogFinished(const Screen *dialog, DialogResult result) override; + void RecreateViews() override; private: void TriggerRestart(const char *why); @@ -137,6 +138,9 @@ private: // Android-only std::string pendingMemstickFolder_; + + // If we recreate the views while this is active we show it again + std::string oldSettingInfo_; }; class DeveloperToolsScreen : public UIDialogScreenWithBackground { diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 683b35918a..26fd1101da 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -1086,4 +1086,9 @@ void SettingInfoMessage::Draw(UIContext &dc) { text_->SetTextColor(whiteAlpha(alpha)); ViewGroup::Draw(dc); + showing_ = sinceShow <= timeToShow; // Don't consider fade time } + +std::string SettingInfoMessage::GetText() const { + return showing_ && text_ ? text_->GetText() : ""; +} \ No newline at end of file diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index d1fc2bc6a7..05a4708578 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -175,9 +175,11 @@ public: void Show(const std::string &text, UI::View *refView = nullptr); void Draw(UIContext &dc); + std::string GetText() const; private: UI::TextView *text_ = nullptr; double timeShown_ = 0.0; float cutOffY_; + bool showing_ = false; };