Initial work on instant type-to-search.

This commit is contained in:
Henrik Rydgård committed 2026-04-14 18:17:54 -06:00
1 parent eb476d522e
commit 6c2c4606dc
3 files changed
+91 -10

No files matched your search

+11 -4
View File
@@ -138,7 +138,10 @@ void MainScreen::CreateRecentTab() {
using namespace UI;
auto mm = GetI18NCategory(I18NCat::MAINMENU);
ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
LinearLayout *recentContainer = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
SearchBar *search = recentContainer->Add(new SearchBar(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
ScrollView *scrollRecentGames = recentContainer->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
scrollRecentGames->SetTag("MainScreenRecentGames");
bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait;
@@ -146,11 +149,12 @@ void MainScreen::CreateRecentTab() {
GameBrowser *tabRecentGames = new GameBrowser(GetRequesterToken(),
Path("!RECENT"), BrowseFlags::NONE, portrait, &g_Config.bGridView1, screenManager(), "", "",
new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
tabRecentGames->SetSearchBar(search);
scrollRecentGames->Add(tabRecentGames);
gameBrowsers_.push_back(tabRecentGames);
tabHolder_->AddTab(mm->T("Recent"), ImageID::invalid(), scrollRecentGames);
tabHolder_->AddTab(mm->T("Recent"), ImageID::invalid(), recentContainer);
tabRecentGames->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant);
tabRecentGames->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected);
tabRecentGames->OnHighlight.Handle(this, &MainScreen::OnGameHighlight);
@@ -572,8 +576,11 @@ void MainScreen::update() {
UpdateUIState(UISTATE_MENU);
if (searchChanged_) {
for (auto browser : gameBrowsers_)
browser->ApplySearchFilter(searchFilter_);
for (auto browser : gameBrowsers_) {
if (browser->GetVisibility() == UI::V_VISIBLE) {
browser->SetSearchFilter(searchFilter_);
}
}
searchChanged_ = false;
}
}