Move persistent notifications (the only one right now is upgrade reminder) to the top

This commit is contained in:
Henrik Rydgård committed 2026-09-22 09:34:50 -06:00
1 parent 7a9a354e50
commit b366e8a6d0
2 files changed
+16 -14

No files matched your search

+5
View File
@@ -50,6 +50,11 @@ public:
views_.push_back(view); views_.push_back(view);
return view; return view;
} }
template <class T>
T *Insert(int index, T *view) {
views_.insert(views_.begin() + index, view);
return view;
}
// Note: This deletes the old view, if found. Returns whether the view was found. // Note: This deletes the old view, if found. Returns whether the view was found.
// If it fails, the newView is deleted. // If it fails, the newView is deleted.
+11 -14
View File
@@ -362,6 +362,9 @@ void MainScreen::CreateViews() {
auto mm = GetI18NCategory(I18NCat::MAINMENU); auto mm = GetI18NCategory(I18NCat::MAINMENU);
// Thie is the true root, leaves room for persistent notifications.
root_ = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 64, TabHolderFlags::Default, nullptr, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f)); tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 64, TabHolderFlags::Default, nullptr, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f));
ViewGroup *leftColumn = tabHolder_; ViewGroup *leftColumn = tabHolder_;
tabHolder_->SetTag("MainScreenGames"); tabHolder_->SetTag("MainScreenGames");
@@ -454,13 +457,13 @@ void MainScreen::CreateViews() {
CreateMainButtons(buttonGroup, vertical); CreateMainButtons(buttonGroup, vertical);
header->Add(buttonGroup); header->Add(buttonGroup);
LinearLayout *rootLayout = new LinearLayout(ORIENT_VERTICAL); LinearLayout *rootLayout = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
rootLayout->SetSpacing(0.0f); rootLayout->SetSpacing(0.0f);
leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0f)); leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0f));
rootLayout->Add(header); rootLayout->Add(header);
rootLayout->Add(leftColumn); rootLayout->Add(leftColumn);
root_ = rootLayout; root_->Add(rootLayout);
// no space for a fullscreen button! // no space for a fullscreen button!
} else { } else {
@@ -489,9 +492,10 @@ void MainScreen::CreateViews() {
rightColumn->Add(rightColumnItems); rightColumn->Add(rightColumnItems);
root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *columns = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(1.0f));
root_->Add(leftColumn); columns->Add(leftColumn);
root_->Add(rightColumn); columns->Add(rightColumn);
root_->Add(columns);
} }
if (focusButton) { if (focusButton) {
@@ -505,9 +509,6 @@ void MainScreen::CreateViews() {
if (!g_Config.sUpgradeMessage.empty()) { if (!g_Config.sUpgradeMessage.empty()) {
auto di = GetI18NCategory(I18NCat::DIALOG); auto di = GetI18NCategory(I18NCat::DIALOG);
Margins margins(0, 0); Margins margins(0, 0);
if (vertical) {
margins.bottom = ITEM_HEIGHT;
}
UI::LinearLayout *upgradeBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, margins)); UI::LinearLayout *upgradeBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, margins));
UI::Margins textMargins(10, 5); UI::Margins textMargins(10, 5);
@@ -529,12 +530,8 @@ void MainScreen::CreateViews() {
RecreateViews(); RecreateViews();
}); });
// Slip in under root_ // Slip in at the top.
LinearLayout *newRoot = new LinearLayout(ORIENT_VERTICAL); root_->Insert(0, upgradeBar);
newRoot->Add(root_);
newRoot->Add(upgradeBar);
root_->ReplaceLayoutParams(new LinearLayoutParams(1.0));
root_ = newRoot;
} }
} }