From 85393862e1fa324ddce2d0c1e9bcf4b9b22ef887 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 27 Nov 2021 12:10:54 +0800 Subject: [PATCH] [Mobile] Fix portrait layout for variant selection --- .../screens/constructed/LobbyScreen.java | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/constructed/LobbyScreen.java b/forge-gui-mobile/src/forge/screens/constructed/LobbyScreen.java index 571022aa317..7350f457952 100644 --- a/forge-gui-mobile/src/forge/screens/constructed/LobbyScreen.java +++ b/forge-gui-mobile/src/forge/screens/constructed/LobbyScreen.java @@ -272,18 +272,33 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView { float x = PADDING; float y = startY + PADDING; float fieldHeight = cbPlayerCount.getHeight(); - lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight); - x += lblVariants.getWidth(); - cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2 - + lblPlayers.getAutoSizeBounds().width + (Utils.AVG_FINGER_WIDTH + PADDING)*2), fieldHeight); - x += cbVariants.getWidth(); - 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); + if (Forge.isLandscapeMode()) { + lblVariants.setBounds(x, y, lblVariants.getAutoSizeBounds().width + PADDING / 2, fieldHeight); + x += lblVariants.getWidth(); + cbVariants.setBounds(x, y, width - (x + lblGamesInMatch.getAutoSizeBounds().width + PADDING/2 + + lblPlayers.getAutoSizeBounds().width + (Utils.AVG_FINGER_WIDTH + PADDING)*2), fieldHeight); + x += cbVariants.getWidth(); + 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); + } 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; playersScroll.setBounds(0, y, width, height - y); }