[Mobile] Fix portrait layout for variant selection

This commit is contained in:
Anthony Calosa
2021-11-27 12:10:54 +08:00
parent 0145bb9470
commit 85393862e1

View File

@@ -272,6 +272,7 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
float x = PADDING; float x = PADDING;
float y = startY + PADDING; float y = startY + PADDING;
float fieldHeight = cbPlayerCount.getHeight(); float fieldHeight = cbPlayerCount.getHeight();
if (Forge.isLandscapeMode()) {
lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight); lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
x += lblVariants.getWidth(); x += lblVariants.getWidth();
cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2 cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2
@@ -284,6 +285,20 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
lblGamesInMatch.setBounds(x, y, lblGamesInMatch.getAutoSizeBounds().width + PADDING / 2, fieldHeight); lblGamesInMatch.setBounds(x, y, lblGamesInMatch.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
x += lblGamesInMatch.getWidth(); x += lblGamesInMatch.getWidth();
cbGamesInMatch.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight); cbGamesInMatch.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight);
} else {
lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
x += lblVariants.getWidth();
cbVariants.setBounds(x, y, width - x - PADDING, fieldHeight);
x = PADDING;
y += cbVariants.getHeight() + PADDING;
lblPlayers.setBounds(x, y, lblPlayers.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
x += lblPlayers.getWidth();
cbPlayerCount.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight);
x += cbPlayerCount.getWidth() + PADDING;
lblGamesInMatch.setBounds(x, y, lblGamesInMatch.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
x += lblGamesInMatch.getWidth();
cbGamesInMatch.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight);
}
y += cbPlayerCount.getHeight() + PADDING; y += cbPlayerCount.getHeight() + PADDING;
playersScroll.setBounds(0, y, width, height - y); playersScroll.setBounds(0, y, width, height - y);
} }