mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Use the banner support for the search filter notice.
This commit is contained in:
parent
0ba92081ed
commit
4d43ee5f59
2 changed files with 11 additions and 13 deletions
|
@ -18,11 +18,6 @@ UI::LinearLayout *TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag
|
||||||
|
|
||||||
if (!isSearch) {
|
if (!isSearch) {
|
||||||
settingTabContents_.push_back(contents);
|
settingTabContents_.push_back(contents);
|
||||||
|
|
||||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
|
||||||
auto notice = contents->Add(new TextView(se->T("Filtering settings by '%1'"), new LinearLayoutParams(Margins(20, 5))));
|
|
||||||
notice->SetVisibility(V_GONE);
|
|
||||||
settingTabFilterNotices_.push_back(notice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return contents;
|
return contents;
|
||||||
|
@ -40,16 +35,20 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
|
||||||
|
|
||||||
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||||
|
|
||||||
|
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||||
|
filterNotice_ = new TextView(se->T("Filtering settings by '%1'"), new LinearLayoutParams(Margins(20, 5)));
|
||||||
|
filterNotice_->SetVisibility(V_GONE);
|
||||||
|
|
||||||
if (vertical) {
|
if (vertical) {
|
||||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||||
LinearLayout *verticalLayout = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
LinearLayout *verticalLayout = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||||
tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 200, nullptr, new LinearLayoutParams(1.0f));
|
tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 200, filterNotice_, new LinearLayoutParams(1.0f));
|
||||||
verticalLayout->Add(tabHolder_);
|
verticalLayout->Add(tabHolder_);
|
||||||
CreateExtraButtons(verticalLayout, 0);
|
CreateExtraButtons(verticalLayout, 0);
|
||||||
verticalLayout->Add(new Choice(di->T("Back"), "", false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 0.0f, Margins(0))))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
verticalLayout->Add(new Choice(di->T("Back"), "", false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 0.0f, Margins(0))))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||||
root_->Add(verticalLayout);
|
root_->Add(verticalLayout);
|
||||||
} else {
|
} else {
|
||||||
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 200, new TextView("I am a banner"), new AnchorLayoutParams(10, 0, 10, 0, false));
|
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 200, filterNotice_, new AnchorLayoutParams(10, 0, 10, 0, false));
|
||||||
CreateExtraButtons(tabHolder_->Container(), 10);
|
CreateExtraButtons(tabHolder_->Container(), 10);
|
||||||
tabHolder_->AddBack(this);
|
tabHolder_->AddBack(this);
|
||||||
root_->Add(tabHolder_);
|
root_->Add(tabHolder_);
|
||||||
|
@ -58,7 +57,6 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
|
||||||
tabHolder_->SetTag(tag()); // take the tag from the screen.
|
tabHolder_->SetTag(tag()); // take the tag from the screen.
|
||||||
root_->SetDefaultFocusView(tabHolder_);
|
root_->SetDefaultFocusView(tabHolder_);
|
||||||
settingTabContents_.clear();
|
settingTabContents_.clear();
|
||||||
settingTabFilterNotices_.clear();
|
|
||||||
|
|
||||||
float leftSide = 40.0f;
|
float leftSide = 40.0f;
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
|
@ -124,15 +122,15 @@ void TabbedUIDialogScreenWithGameBackground::RecreateViews() {
|
||||||
void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
|
void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
|
||||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||||
|
|
||||||
|
// Show an indicator that a filter is applied.
|
||||||
|
filterNotice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
|
||||||
|
filterNotice_->SetText(ApplySafeSubstitutions(se->T("Filtering settings by '%1'"), searchFilter_));
|
||||||
|
|
||||||
bool matches = searchFilter_.empty();
|
bool matches = searchFilter_.empty();
|
||||||
for (int t = 0; t < (int)settingTabContents_.size(); ++t) {
|
for (int t = 0; t < (int)settingTabContents_.size(); ++t) {
|
||||||
auto tabContents = settingTabContents_[t];
|
auto tabContents = settingTabContents_[t];
|
||||||
bool tabMatches = searchFilter_.empty();
|
bool tabMatches = searchFilter_.empty();
|
||||||
|
|
||||||
// Show an indicator that a filter is applied.
|
|
||||||
settingTabFilterNotices_[t]->SetVisibility(tabMatches ? UI::V_GONE : UI::V_VISIBLE);
|
|
||||||
settingTabFilterNotices_[t]->SetText(ApplySafeSubstitutions(se->T("Filtering settings by '%1'"), searchFilter_));
|
|
||||||
|
|
||||||
UI::View *lastHeading = nullptr;
|
UI::View *lastHeading = nullptr;
|
||||||
for (int i = 1; i < tabContents->GetNumSubviews(); ++i) {
|
for (int i = 1; i < tabContents->GetNumSubviews(); ++i) {
|
||||||
UI::View *v = tabContents->GetViewByIndex(i);
|
UI::View *v = tabContents->GetViewByIndex(i);
|
||||||
|
|
|
@ -31,7 +31,7 @@ private:
|
||||||
|
|
||||||
UI::TabHolder *tabHolder_ = nullptr;
|
UI::TabHolder *tabHolder_ = nullptr;
|
||||||
std::vector<UI::LinearLayout *> settingTabContents_;
|
std::vector<UI::LinearLayout *> settingTabContents_;
|
||||||
std::vector<UI::TextView *> settingTabFilterNotices_;
|
UI::TextView *filterNotice_ = nullptr;
|
||||||
UI::Choice *clearSearchChoice_ = nullptr;
|
UI::Choice *clearSearchChoice_ = nullptr;
|
||||||
UI::TextView *noSearchResults_ = nullptr;
|
UI::TextView *noSearchResults_ = nullptr;
|
||||||
// If we recreate the views while this is active we show it again
|
// If we recreate the views while this is active we show it again
|
||||||
|
|
Loading…
Add table
Reference in a new issue