Implement cheat search on mobile

This commit is contained in:
Henrik Rydgård committed 2026-05-04 00:36:16 +02:00
1 parent 691c1f3251
commit 71d04bfcae
5 files changed
+47 -5

No files matched your search

+15
View File
@@ -114,6 +114,17 @@ void CwCheatScreen::CreateSettingsViews(UI::ViewGroup *leftColumn) {
leftColumn->Add(new Choice(mm->T("Browse"), ImageID("I_FOLDER_OPEN")))->OnClick.Handle(this, &CwCheatScreen::OnImportBrowse);
leftColumn->Add(new ItemHeader(di->T("Options")));
Choice *searchChoice = leftColumn->Add(new Choice(di->T("Search"), ImageID("I_SEARCH")));
searchChoice->OnClick.Add([this, searchChoice, screenManager = screenManager(), token = GetRequesterToken()](UI::EventParams &) {
auto di = GetI18NCategory(I18NCat::DIALOG);
AskForInput(screenManager, token, searchChoice, di->T("Search"), [this](const std::string &text, bool success) {
if (!success) {
return;
}
search_.searchFilter = text;
search_.ApplySearchFilter(cheatList_, false);
});
});
#if !defined(MOBILE_DEVICE)
leftColumn->Add(new Choice(cw->T("Edit Cheat File")))->OnClick.Handle(this, &CwCheatScreen::OnEditCheatFile);
#endif
@@ -130,6 +141,10 @@ void CwCheatScreen::CreateContentViews(UI::ViewGroup *parent) {
UI::LinearLayout *rightSide = parent->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 0.5f)));
search_.searchFilter.clear();
search_.searchBar = rightSide->Add(new SearchBar(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
search_.searchBar->OnCancel.Add([this](UI::EventParams &) {
search_.searchFilter.clear();
search_.ApplySearchFilter(cheatList_, false);
});
UI::ScrollView *rightScroll = rightSide->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f)));
rightScroll->SetTag("CwCheats");