[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,18 +272,33 @@ 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();
lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight); if (Forge.isLandscapeMode()) {
x += lblVariants.getWidth(); lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2 x += lblVariants.getWidth();
+ lblPlayers.getAutoSizeBounds().width + (Utils.AVG_FINGER_WIDTH + PADDING)*2), fieldHeight); cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2
x += cbVariants.getWidth(); + lblPlayers.getAutoSizeBounds().width + (Utils.AVG_FINGER_WIDTH + PADDING)*2), fieldHeight);
lblPlayers.setBounds(x, y, lblPlayers.getAutoSizeBounds().width + PADDING / 2, fieldHeight); x += cbVariants.getWidth();
x += lblPlayers.getWidth(); lblPlayers.setBounds(x, y, lblPlayers.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
cbPlayerCount.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight); x += lblPlayers.getWidth();
x += cbPlayerCount.getWidth() + PADDING; cbPlayerCount.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight);
lblGamesInMatch.setBounds(x, y, lblGamesInMatch.getAutoSizeBounds().width + PADDING / 2, fieldHeight); x += cbPlayerCount.getWidth() + PADDING;
x += lblGamesInMatch.getWidth(); lblGamesInMatch.setBounds(x, y, lblGamesInMatch.getAutoSizeBounds().width + PADDING / 2, fieldHeight);
cbGamesInMatch.setBounds(x, y, Utils.AVG_FINGER_WIDTH, fieldHeight); x += lblGamesInMatch.getWidth();
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);
} }