UI: Have scroll views directly remember their pos.

Kinda like checkboxes, cleaner this way.
This commit is contained in:
Unknown W. Brackets
2021-09-27 23:25:41 -07:00
parent 4d5a63a74e
commit fc78b408b2
4 changed files with 14 additions and 16 deletions
+2 -5
View File
@@ -1007,7 +1007,7 @@ void MainScreen::CreateViews() {
Button *focusButton = nullptr;
if (hasStorageAccess) {
scrollAllGames_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT), true);
scrollAllGames_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
scrollAllGames_->SetTag("MainScreenAllGames");
ScrollView *scrollHomebrew = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
scrollHomebrew->SetTag("MainScreenHomebrew");
@@ -1026,7 +1026,7 @@ void MainScreen::CreateViews() {
tabHolder_->AddTab(mm->T("Games"), scrollAllGames_);
tabHolder_->AddTab(mm->T("Homebrew & Demos"), scrollHomebrew);
scrollAllGames_->ScrollTo(g_Config.fGameListScrollPosition);
scrollAllGames_->RememberPosition(&g_Config.fGameListScrollPosition);
tabAllGames->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant);
tabHomebrew->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant);
@@ -1248,9 +1248,6 @@ void MainScreen::update() {
RecreateViews();
lastVertical_ = vertical;
}
if (scrollAllGames_) {
g_Config.fGameListScrollPosition = scrollAllGames_->GetScrollPosition();
}
}
bool MainScreen::UseVerticalLayout() const {