Skip to content

Commit

Permalink
ho-dev#2063 add 5 new countries to international flags module (review)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsbrenk committed May 5, 2024
1 parent 8b585e2 commit 4f727df
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/main/java/module/ifa/FlagPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void initialize(boolean away, IfaModel ifaModel, FlagDisplayModel flagDi
constraints.gridwidth = 1;

if (this.flagLabels != null) {
int i=0;
int i = 0;
for (var flagLabel : this.flagLabels) {
constraints.gridx = i % flagDisplayModel.getFlagWidth();
constraints.gridy = 2 + i / flagDisplayModel.getFlagWidth();
Expand All @@ -96,9 +96,9 @@ void setHeaderVisible(boolean enable) {
private void createFlagLabels(boolean away, IfaModel ifaModel, FlagDisplayModel flagDisplayModel) {
this.flagLabels = new ArrayList<>();
WorldDetailsManager.instance().getLeagues().stream()
.filter(l->l.getLeagueId()!=APACHE_LEAGUE_ID)
.sorted((l1,l2)-> ObjectUtils.compare(l1.getCountryName(),l2.getCountryName()))
.forEach(l->addFlagLabel(l, away, ifaModel, flagDisplayModel));
.filter(l -> l.getLeagueId() != APACHE_LEAGUE_ID)
.sorted((l1, l2) -> ObjectUtils.compare(l1.getCountryName(), l2.getCountryName()))
.forEach(l -> addFlagLabel(l, away, ifaModel, flagDisplayModel));
}

private void addFlagLabel(WorldDetailLeague league, boolean away, IfaModel ifaModel, FlagDisplayModel flagDisplayModel) {
Expand All @@ -107,13 +107,7 @@ private void addFlagLabel(WorldDetailLeague league, boolean away, IfaModel ifaMo
flagLabel.setCountryName(league.getCountryName());
flagLabel.setIcon(ImageUtilities.getCountryFlagIcon(flagLabel.getCountryId()));
flagLabel.setToolTipText(flagLabel.getCountryName());

if ((away && ifaModel.isVisited(league.getCountryId()))
|| (!away && ifaModel.isHosted(league.getCountryId()))) {
flagLabel.setEnabled(true);
} else {
flagLabel.setEnabled(false);
}
flagLabel.setEnabled((away && ifaModel.isVisited(league.getCountryId())) || (!away && ifaModel.isHosted(league.getCountryId())));
this.flagLabels.add(flagLabel);
}
}

0 comments on commit 4f727df

Please sign in to comment.