fix: visual display of too many games/files for a game view

The game- and file count for a gameview in the gamelist dropdown is shown in red color if it contain more than 255 games, which is the limit for games in the Carousel and in a folder in the file loader/media access.
This commit is contained in:
lantzelot-swe 2023-08-14 22:16:52 +02:00
parent d16e3dc815
commit 1d53647a7e
1 changed files with 20 additions and 7 deletions

View File

@ -10,6 +10,9 @@ import se.lantz.util.DbConstants;
public class GameView implements Comparable public class GameView implements Comparable
{ {
private static final String fontRedStart = "<FONT COLOR=\"#ff0000\">";
private static final String fontRedEnd = "</FONT COLOR>";
public static final String FAV_GAMEVIEW_NAME_PREF_KEY = "GameViewFavoritesName_"; public static final String FAV_GAMEVIEW_NAME_PREF_KEY = "GameViewFavoritesName_";
public static final int ALL_GAMES_ID = -1; public static final int ALL_GAMES_ID = -1;
public static final int FAVORITES_ID = -2; public static final int FAVORITES_ID = -2;
@ -62,18 +65,28 @@ public class GameView implements Comparable
@Override @Override
public String toString() public String toString()
{ {
String text = "";
if (gameCount > -1) if (gameCount > -1)
{ {
if (gameViewId != -1 && gameCount < fileCount) if (gameViewId != -1)
{ {
return name + " (" + gameCount + "/" + fileCount + ")"; String gameCountString = gameCount > 255 ? fontRedStart + gameCount + fontRedEnd : gameCount + "";
String fileCountString = fileCount > 255 ? fontRedStart + fileCount + fontRedEnd : fileCount + "";
if (gameCount < fileCount)
{
text = name + " (" + gameCountString + "/" + fileCountString + ")";
} }
else else
{ {
return name + " (" + gameCount + ")"; text = name + " (" + gameCountString + ")";
} }
} }
return name; else
{
text = name + " (" + gameCount + ")";
}
}
return "<html>" + text + "</html>";
} }
public List<ViewFilter> getViewFilters() public List<ViewFilter> getViewFilters()