diff --git a/forge-gui-desktop/src/main/java/forge/control/KeyboardShortcuts.java b/forge-gui-desktop/src/main/java/forge/control/KeyboardShortcuts.java index 13ec4af6ecb..52f361a13d5 100644 --- a/forge-gui-desktop/src/main/java/forge/control/KeyboardShortcuts.java +++ b/forge-gui-desktop/src/main/java/forge/control/KeyboardShortcuts.java @@ -106,7 +106,7 @@ public class KeyboardShortcuts { public void actionPerformed(final ActionEvent e) { if (!Singletons.getControl().getCurrentScreen().isMatchScreen()) { return; } if (matchUI == null) { return; } - matchUI.getGameController().concede(); + matchUI.concede(); } }; diff --git a/forge-gui-mobile/src/forge/card/CardZoom.java b/forge-gui-mobile/src/forge/card/CardZoom.java index 6215887583b..fe6e2f037eb 100644 --- a/forge-gui-mobile/src/forge/card/CardZoom.java +++ b/forge-gui-mobile/src/forge/card/CardZoom.java @@ -9,16 +9,13 @@ import com.badlogic.gdx.math.Rectangle; import forge.Graphics; import forge.ImageKeys; -import forge.assets.FSkinColor; -import forge.assets.FSkinFont; -import forge.assets.FSkinColor.Colors; import forge.assets.FSkinImage; import forge.game.card.CardView; import forge.item.IPaperCard; import forge.item.InventoryItem; -import forge.screens.FScreen; import forge.screens.match.MatchController; import forge.toolbox.FCardPanel; +import forge.toolbox.FDialog; import forge.toolbox.FOptionPane; import forge.toolbox.FOverlay; import forge.util.FCollectionView; @@ -26,9 +23,6 @@ import forge.util.Utils; public class CardZoom extends FOverlay { private static final float REQ_AMOUNT = Utils.AVG_FINGER_WIDTH; - private static final FSkinFont MSG_FONT = FSkinFont.get(12); - private static final FSkinColor MSG_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.9f); - private static final FSkinColor MSG_BACK_COLOR = FScreen.Header.BACK_COLOR.alphaColor(0.75f); private static final CardZoom cardZoom = new CardZoom(); private static List items; @@ -175,7 +169,7 @@ public class CardZoom extends FOverlay { public void drawOverlay(Graphics g) { float w = getWidth(); float h = getHeight(); - float messageHeight = MSG_FONT.getCapHeight() * 2.5f; + float messageHeight = FDialog.MSG_HEIGHT; float maxCardHeight = h - 2 * messageHeight; float cardWidth, cardHeight, y; @@ -218,11 +212,11 @@ public class CardZoom extends FOverlay { } if (currentActivateAction != null) { - g.fillRect(MSG_BACK_COLOR, 0, 0, w, messageHeight); - g.drawText("Swipe up to " + currentActivateAction, MSG_FONT, MSG_FORE_COLOR, 0, 0, w, messageHeight, false, HAlignment.CENTER, true); + g.fillRect(FDialog.MSG_BACK_COLOR, 0, 0, w, messageHeight); + g.drawText("Swipe up to " + currentActivateAction, FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, 0, w, messageHeight, false, HAlignment.CENTER, true); } - g.fillRect(MSG_BACK_COLOR, 0, h - messageHeight, w, messageHeight); - g.drawText("Swipe down to switch to " + (zoomMode ? "detail" : "picture") + " view", MSG_FONT, MSG_FORE_COLOR, 0, h - messageHeight, w, messageHeight, false, HAlignment.CENTER, true); + g.fillRect(FDialog.MSG_BACK_COLOR, 0, h - messageHeight, w, messageHeight); + g.drawText("Swipe down to switch to " + (zoomMode ? "detail" : "picture") + " view", FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, h - messageHeight, w, messageHeight, false, HAlignment.CENTER, true); } @Override diff --git a/forge-gui-mobile/src/forge/card/GameEntityPicker.java b/forge-gui-mobile/src/forge/card/GameEntityPicker.java index e8168308962..4e6880157f9 100644 --- a/forge-gui-mobile/src/forge/card/GameEntityPicker.java +++ b/forge-gui-mobile/src/forge/card/GameEntityPicker.java @@ -12,7 +12,6 @@ import forge.game.GameEntityView; import forge.game.card.CardView; import forge.screens.TabPageScreen; import forge.toolbox.FChoiceList; -import forge.toolbox.FDialog; import forge.toolbox.FEvent; import forge.toolbox.FOptionPane; import forge.toolbox.FTextField; @@ -39,15 +38,9 @@ public class GameEntityPicker extends TabPageScreen { callback.run(null); } } - }) { - @Override - protected boolean padDisplayObject() { - return false; //let tabs go right up to edges of dialog - } - }; + }); - setHeight(Forge.getCurrentScreen().getHeight() - FDialog.TITLE_HEIGHT - - 3 * FOptionPane.PADDING - FOptionPane.BUTTON_HEIGHT - FOptionPane.GAP_BELOW_BUTTONS); + setHeight(Forge.getCurrentScreen().getHeight() - 2 * FOptionPane.PADDING); } public void show() { diff --git a/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java b/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java index 91793e0d396..1e84317381f 100644 --- a/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java +++ b/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java @@ -32,7 +32,6 @@ import forge.card.CardZoom; import forge.card.mana.ManaCostShard; import forge.item.PaperCard; import forge.model.FModel; -import forge.toolbox.FButton; import forge.toolbox.FCardPanel; import forge.toolbox.FComboBox; import forge.toolbox.FContainer; @@ -88,9 +87,6 @@ public class AddBasicLandsDialog extends FDialog { private final FTextArea lblDeckInfo = add(new FTextArea(true)); - private final FButton btnOK = add(new FButton("OK")); - private final FButton btnCancel = add(new FButton("Cancel")); - private int nonLandCount, oldLandCount; private CardEdition landSet; @@ -98,7 +94,7 @@ public class AddBasicLandsDialog extends FDialog { this(deck, defaultLandSet, null, callback0); } public AddBasicLandsDialog(Deck deck, CardEdition defaultLandSet, CardPool restrictedCatalog0, final Callback callback0) { - super("Add Basic Lands to " + deck.getName()); + super("Add Basic Lands to " + deck.getName(), 2); callback = callback0; @@ -119,7 +115,7 @@ public class AddBasicLandsDialog extends FDialog { }); cbLandSet.setSelectedItem(defaultLandSet); - btnOK.setCommand(new FEventHandler() { + initButton(0, "OK", new FEventHandler() { @Override public void handleEvent(FEvent e) { CardPool landsToAdd = new CardPool(); @@ -136,7 +132,7 @@ public class AddBasicLandsDialog extends FDialog { } } }); - btnCancel.setCommand(new FEventHandler() { + initButton(1, "Cancel", new FEventHandler() { @Override public void handleEvent(FEvent e) { hide(); @@ -250,15 +246,7 @@ public class AddBasicLandsDialog extends FDialog { y += panelHeight + padding; lblDeckInfo.setBounds(x, y, w, lblDeckInfo.getPreferredHeight(w)); - //layout buttons - y += lblDeckInfo.getHeight() + padding; - float gapBetweenButtons = padding / 2; - float buttonWidth = (w - gapBetweenButtons) / 2; - btnOK.setBounds(x, y, buttonWidth, FOptionPane.BUTTON_HEIGHT); - x += buttonWidth + gapBetweenButtons; - btnCancel.setBounds(x, y, buttonWidth, FOptionPane.BUTTON_HEIGHT); - - return y + FOptionPane.BUTTON_HEIGHT + FOptionPane.GAP_BELOW_BUTTONS; + return y; } private void updateDeckInfoLabel() { diff --git a/forge-gui-mobile/src/forge/deck/FSideboardDialog.java b/forge-gui-mobile/src/forge/deck/FSideboardDialog.java index 1cab6e1e8b9..fa5bc4115d1 100644 --- a/forge-gui-mobile/src/forge/deck/FSideboardDialog.java +++ b/forge-gui-mobile/src/forge/deck/FSideboardDialog.java @@ -13,7 +13,6 @@ import forge.itemmanager.filters.ItemFilter; import forge.menu.FDropDownMenu; import forge.menu.FMenuItem; import forge.screens.TabPageScreen; -import forge.toolbox.FButton; import forge.toolbox.FDialog; import forge.toolbox.FEvent; import forge.toolbox.FOptionPane; @@ -23,16 +22,14 @@ import forge.util.Callback; public class FSideboardDialog extends FDialog { private final SideboardTabs tabs; - private final FButton btnOK; private final Callback> callback; public FSideboardDialog(CardPool sideboard, CardPool main, final Callback> callback0) { - super("Update main deck from sideboard"); + super("Update main deck from sideboard", 1); callback = callback0; tabs = add(new SideboardTabs(sideboard, main)); - btnOK = add(new FButton("OK")); - btnOK.setCommand(new FEventHandler() { + initButton(1, "OK", new FEventHandler() { @Override public void handleEvent(FEvent e) { hide(); @@ -53,14 +50,7 @@ public class FSideboardDialog extends FDialog { @Override protected float layoutAndGetHeight(float width, float maxHeight) { - float buttonHeight = FOptionPane.BUTTON_HEIGHT; - float buttonTop = maxHeight - buttonHeight - FOptionPane.GAP_BELOW_BUTTONS; - - tabs.setBounds(0, 0, width, buttonTop - FOptionPane.PADDING); - - float buttonWidth = width / 2; - btnOK.setBounds((width - buttonWidth) / 2, buttonTop, buttonWidth, buttonHeight); - + tabs.setBounds(0, 0, width, maxHeight); return maxHeight; } diff --git a/forge-gui-mobile/src/forge/error/BugReportDialog.java b/forge-gui-mobile/src/forge/error/BugReportDialog.java index cc7f0b5fd11..aef489b2c34 100644 --- a/forge-gui-mobile/src/forge/error/BugReportDialog.java +++ b/forge-gui-mobile/src/forge/error/BugReportDialog.java @@ -12,7 +12,6 @@ import forge.screens.FScreen; import forge.toolbox.FButton; import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; -import forge.toolbox.FOptionPane; import forge.toolbox.FScrollPane; import forge.toolbox.FTextArea; import forge.util.Callback; @@ -20,6 +19,7 @@ import forge.util.Utils; public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered private static final float PADDING = Utils.scale(5); + private static final float BUTTON_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f; private static boolean isOpen; public static void show(String title, String text, boolean showExitAppBtn) { @@ -87,7 +87,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s y += lblHeader.getHeight() + PADDING; float buttonWidth = (w - PADDING) / 2; - float buttonHeight = FOptionPane.BUTTON_HEIGHT; + float buttonHeight = BUTTON_HEIGHT; tvDetails.setBounds(x, y, w, height - 2 * buttonHeight - 3 * PADDING - y); y += tvDetails.getHeight() + PADDING; diff --git a/forge-gui-mobile/src/forge/screens/LoadingOverlay.java b/forge-gui-mobile/src/forge/screens/LoadingOverlay.java index 648baaf6fc2..98f7baa7f97 100644 --- a/forge-gui-mobile/src/forge/screens/LoadingOverlay.java +++ b/forge-gui-mobile/src/forge/screens/LoadingOverlay.java @@ -8,12 +8,12 @@ import forge.assets.FSkinColor; import forge.assets.FSkinColor.Colors; import forge.assets.FSkinFont; import forge.assets.FSkinImage; -import forge.toolbox.FDialog; import forge.toolbox.FOverlay; import forge.util.ThreadUtil; import forge.util.Utils; public class LoadingOverlay extends FOverlay { + private static final float INSETS = Utils.scale(10); private static final float LOGO_SIZE_FACTOR = 0.7f; private static final float INSETS_FACTOR = 0.025f; private static final FSkinFont FONT = FSkinFont.get(22); @@ -53,9 +53,8 @@ public class LoadingOverlay extends FOverlay { @Override public void drawOverlay(Graphics g) { - float insets = FDialog.INSETS; - float x = insets; - float w = getWidth() - 2 * insets; + float x = INSETS; + float w = getWidth() - 2 * INSETS; float padding = w * INSETS_FACTOR; float logoSize = w * LOGO_SIZE_FACTOR; diff --git a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java index 12db0b9ff85..a4382fc8a94 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java @@ -377,7 +377,7 @@ public class MatchScreen extends FScreen { break; case Keys.Q: //concede game on Ctrl+Q if (KeyInputAdapter.isCtrlKeyDown()) { - getGameController().concede(); + MatchController.instance.concede(); return true; } break; diff --git a/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java b/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java index 9be0824eef9..310f7c515b3 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java @@ -28,7 +28,6 @@ import forge.game.GameEntityView; import forge.game.card.CardView; import forge.game.player.PlayerView; import forge.screens.match.MatchController; -import forge.toolbox.FButton; import forge.toolbox.FCardPanel; import forge.toolbox.FContainer; import forge.toolbox.FDialog; @@ -66,10 +65,6 @@ public class VAssignDamage extends FDialog { private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(HAlignment.CENTER).build()); private final FLabel lblAssignRemaining = add(new FLabel.Builder().text("Distribute the remaining damage points among lethally wounded entities").align(HAlignment.CENTER).build()); - private final FButton btnOK = add(new FButton("OK")); - private final FButton btnReset = add(new FButton("Reset")); - private final FButton btnAuto = add(new FButton("Auto")); - private final AttDefCardPanel pnlAttacker; private final DefendersPanel pnlDefenders; @@ -96,7 +91,7 @@ public class VAssignDamage extends FDialog { * @param overrideOrder override combatant order */ public VAssignDamage(final CardView attacker, final List blockers, final int damage0, final GameEntityView defender0, boolean overrideOrder, final WaitCallback> waitCallback) { - super("Assign damage dealt by " + attacker); + super("Assign damage dealt by " + attacker, 3); callback = waitCallback; totalDamageToAssign = damage0; @@ -109,7 +104,7 @@ public class VAssignDamage extends FDialog { pnlAttacker = add(new AttDefCardPanel(attacker)); pnlDefenders = add(new DefendersPanel(blockers)); - btnAuto.setCommand(new FEventHandler() { + initButton(0, "Auto", new FEventHandler() { @Override public void handleEvent(FEvent e) { resetAssignedDamage(); @@ -117,13 +112,13 @@ public class VAssignDamage extends FDialog { finish(); } }); - btnOK.setCommand(new FEventHandler() { + initButton(1, "OK", new FEventHandler() { @Override public void handleEvent(FEvent e) { finish(); } }); - btnReset.setCommand(new FEventHandler() { + initButton(2, "Reset", new FEventHandler() { @Override public void handleEvent(FEvent e) { resetAssignedDamage(); @@ -139,21 +134,9 @@ public class VAssignDamage extends FDialog { float padding = FOptionPane.PADDING; float w = width - 2 * padding; - //layout buttons - float gapBetweenButtons = padding / 2; - float buttonWidth = (w - gapBetweenButtons * 2) / 3; - float buttonHeight = FOptionPane.BUTTON_HEIGHT; float x = padding; - float y = maxHeight - FOptionPane.GAP_BELOW_BUTTONS - buttonHeight; - btnAuto.setBounds(x, y, buttonWidth, buttonHeight); - x += buttonWidth + gapBetweenButtons; - btnOK.setBounds(x, y, buttonWidth, buttonHeight); - x += buttonWidth + gapBetweenButtons; - btnReset.setBounds(x, y, buttonWidth, buttonHeight); - - x = padding; float labelHeight = lblAssignRemaining.getAutoSizeBounds().height; - y -= labelHeight + padding; + float y = maxHeight - labelHeight + padding; lblAssignRemaining.setBounds(x, y, w, labelHeight); float dtOffset = ADD_BTN_HEIGHT + defenders.get(0).label.getAutoSizeBounds().height; @@ -436,7 +419,7 @@ public class VAssignDamage extends FDialog { } lblTotalDamage.setText(String.format("Available damage points: %d (of %d)", damageLeft, totalDamageToAssign)); - btnOK.setEnabled(damageLeft == 0); + setButtonEnabled(1, damageLeft == 0); lblAssignRemaining.setVisible(allHaveLethal && damageLeft > 0); } diff --git a/forge-gui-mobile/src/forge/screens/match/views/VAutoYields.java b/forge-gui-mobile/src/forge/screens/match/views/VAutoYields.java index 90109f7a070..9fa5e41083f 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VAutoYields.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VAutoYields.java @@ -6,7 +6,6 @@ import java.util.List; import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds; import forge.screens.match.MatchController; -import forge.toolbox.FButton; import forge.toolbox.FCheckBox; import forge.toolbox.FChoiceList; import forge.toolbox.FDialog; @@ -15,13 +14,11 @@ import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FOptionPane; public class VAutoYields extends FDialog { - private final FButton btnOk; - private final FButton btnRemove; private final FChoiceList lstAutoYields; private final FCheckBox chkDisableAll; public VAutoYields() { - super("Auto-Yields"); + super("Auto-Yields", 2); List autoYields = new ArrayList(); for (String autoYield : MatchController.instance.getAutoYields()) { autoYields.add(autoYield); @@ -44,26 +41,26 @@ public class VAutoYields extends FDialog { MatchController.instance.setDisableAutoYields(chkDisableAll.isSelected()); } }); - btnOk = add(new FButton("OK", new FEventHandler() { + initButton(0, "OK", new FEventHandler() { @Override public void handleEvent(FEvent e) { hide(); } - })); - btnRemove = add(new FButton("Remove Yield", new FEventHandler() { + }); + initButton(1, "Remove Yield", new FEventHandler() { @Override public void handleEvent(FEvent e) { String selected = lstAutoYields.getSelectedItem(); if (selected != null) { lstAutoYields.removeItem(selected); MatchController.instance.setShouldAutoYield(selected, false); - btnRemove.setEnabled(lstAutoYields.getCount() > 0); + setButtonEnabled(1, lstAutoYields.getCount() > 0); lstAutoYields.cleanUpSelections(); VAutoYields.this.revalidate(); } } - })); - btnRemove.setEnabled(autoYields.size() > 0); + }); + setButtonEnabled(1, autoYields.size() > 0); } @Override @@ -82,12 +79,10 @@ public class VAutoYields extends FDialog { float x = padding; float y = padding; float w = width - 2 * padding; - float buttonWidth = (w - padding) / 2; - float buttonHeight = FOptionPane.BUTTON_HEIGHT; TextBounds checkBoxSize = chkDisableAll.getAutoSizeBounds(); float listHeight = lstAutoYields.getListItemRenderer().getItemHeight() * lstAutoYields.getCount(); - float maxListHeight = maxHeight - 3 * padding - checkBoxSize.height - buttonHeight - FOptionPane.GAP_BELOW_BUTTONS - padding; + float maxListHeight = maxHeight - 3 * padding - checkBoxSize.height; if (listHeight > maxListHeight) { listHeight = maxListHeight; } @@ -96,9 +91,7 @@ public class VAutoYields extends FDialog { y += listHeight + padding; chkDisableAll.setBounds(x, y, Math.min(checkBoxSize.width, w), checkBoxSize.height); y += checkBoxSize.height + padding; - btnOk.setBounds(x, y, buttonWidth, buttonHeight); - btnRemove.setBounds(x + buttonWidth + padding, y, buttonWidth, buttonHeight); - return y + buttonHeight + FOptionPane.GAP_BELOW_BUTTONS; + return y; } } diff --git a/forge-gui-mobile/src/forge/screens/match/views/VGameMenu.java b/forge-gui-mobile/src/forge/screens/match/views/VGameMenu.java index ae33085240d..3887b46866f 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VGameMenu.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VGameMenu.java @@ -25,7 +25,7 @@ public class VGameMenu extends FDropDownMenu { ThreadUtil.invokeInGameThread(new Runnable() { @Override public void run() { - MatchController.instance.getGameController().concede(); + MatchController.instance.concede(); } }); } diff --git a/forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java b/forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java index 890a073f0dc..1a6eaeb8b52 100644 --- a/forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java +++ b/forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java @@ -22,20 +22,19 @@ import java.net.Proxy; import com.badlogic.gdx.Gdx; import forge.UiCommand; -import forge.assets.FSkinFont; import forge.download.GuiDownloadService; import forge.download.GuiDownloadZipService; import forge.toolbox.*; import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FRadioButton.RadioButtonGroup; import forge.util.Callback; +import forge.util.Utils; public class GuiDownloader extends FDialog { public static final Proxy.Type[] TYPES = Proxy.Type.values(); + private static final float PADDING = Utils.scale(10); private final FProgressBar progressBar = add(new FProgressBar()); - private final FButton btnStart = add(new FButton("Start")); - private final FButton btnCancel = add(new FButton("Cancel")); private final FTextField txtAddress = add(new FTextField()); private final FTextField txtPort = add(new FTextField()); private final FRadioButton radProxyNone = add(new FRadioButton("No Proxy")); @@ -50,7 +49,7 @@ public class GuiDownloader extends FDialog { service.setCancel(true); hide(); if (callback != null) { - callback.run(btnStart.getText() == "OK"); //determine result based on whether download finished + callback.run(getButton(0).getText() == "OK"); //determine result based on whether download finished } } }; @@ -62,7 +61,7 @@ public class GuiDownloader extends FDialog { this(service0, null); } public GuiDownloader(GuiDownloadService service0, Callback callback0) { - super(service0.getTitle()); + super(service0.getTitle(), 2); service = service0; callback = callback0; @@ -81,10 +80,13 @@ public class GuiDownloader extends FDialog { radProxySocks.setCommand(new ProxyHandler(2)); radProxyNone.setSelected(true); - btnStart.setFont(FSkinFont.get(18)); - btnStart.setEnabled(false); - btnCancel.setFont(btnStart.getFont()); - btnCancel.setCommand(cmdClose); + getButton(0).setText("Start"); + initButton(1, "Cancel", new FEventHandler() { + @Override + public void handleEvent(FEvent e) { + cmdClose.run(); + } + }); progressBar.reset(); progressBar.setShowProgressTrail(true); @@ -93,7 +95,7 @@ public class GuiDownloader extends FDialog { show(); - service.initialize(txtAddress, txtPort, progressBar, btnStart, cmdClose, new Runnable() { + service.initialize(txtAddress, txtPort, progressBar, getButton(0), cmdClose, new Runnable() { @Override public void run() { if (!(service instanceof GuiDownloadZipService)) { //retain continuous rendering for zip service @@ -123,10 +125,9 @@ public class GuiDownloader extends FDialog { @Override protected float layoutAndGetHeight(float width, float maxHeight) { - float padding = FDialog.INSETS; - float x = padding; - float y = padding; - float w = width - 2 * padding; + float x = PADDING; + float y = PADDING; + float w = width - 2 * PADDING; float radioButtonWidth = w / 3; float radioButtonHeight = radProxyNone.getAutoSizeBounds().height; @@ -136,20 +137,14 @@ public class GuiDownloader extends FDialog { x += radioButtonWidth; radProxySocks.setBounds(x, y, radioButtonWidth, radioButtonHeight); - x = padding; - y += radioButtonHeight + padding; + x = PADDING; + y += radioButtonHeight + PADDING; txtAddress.setBounds(x, y, w, txtAddress.getHeight()); - y += txtAddress.getHeight() + padding; + y += txtAddress.getHeight() + PADDING; txtPort.setBounds(x, y, w, txtPort.getHeight()); - y += txtPort.getHeight() + padding * 2; + y += txtPort.getHeight() + PADDING * 2; progressBar.setBounds(x, y, w, txtPort.getHeight() * 1.5f); - y += progressBar.getHeight() + padding * 2; - - float buttonWidth = (w - padding) / 2; - float buttonHeight = txtPort.getHeight() * 1.5f; - btnStart.setBounds(x, y, buttonWidth, buttonHeight); - x += w - buttonWidth; - btnCancel.setBounds(x, y, buttonWidth, buttonHeight); - return y + buttonHeight + padding; + y += progressBar.getHeight() + PADDING * 2; + return y; } } diff --git a/forge-gui-mobile/src/forge/toolbox/DualListBox.java b/forge-gui-mobile/src/forge/toolbox/DualListBox.java index 2a5fc63bf1a..ea841bacf84 100644 --- a/forge-gui-mobile/src/forge/toolbox/DualListBox.java +++ b/forge-gui-mobile/src/forge/toolbox/DualListBox.java @@ -1,6 +1,5 @@ package forge.toolbox; -import forge.screens.match.views.VPrompt; import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventType; import forge.util.Callback; @@ -29,8 +28,6 @@ public class DualListBox extends FDialog { private final FButton addAllButton; private final FButton removeButton; private final FButton removeAllButton; - private final FButton okButton; - private final FButton autoButton; private final FLabel orderedLabel; private final FLabel selectOrder; @@ -43,7 +40,7 @@ public class DualListBox extends FDialog { } public DualListBox(String title, int remainingSourcesMin, int remainingSourcesMax, List sourceElements, List destElements, final Callback> callback) { - super(title); + super(title, 2); targetRemainingSourcesMin = remainingSourcesMin; targetRemainingSourcesMax = remainingSourcesMax; @@ -116,14 +113,14 @@ public class DualListBox extends FDialog { }; // Dual List Complete Buttons - okButton = add(new FButton("OK", onAccept)); - autoButton = add(new FButton("Auto", new FEventHandler() { + initButton(0, "OK", onAccept); + initButton(1, "Auto", new FEventHandler() { @Override public void handleEvent(FEvent e) { addAll(); onAccept.handleEvent(e); } - })); + }); selectOrder = add(new FLabel.Builder().align(HAlignment.CENTER).text("Select Order").build()); orderedLabel = add(new FLabel.Builder().align(HAlignment.CENTER).build()); @@ -136,12 +133,10 @@ public class DualListBox extends FDialog { float x = FOptionPane.PADDING; float y = FOptionPane.PADDING / 2; width -= 2 * x; - maxHeight -= 2 * (VPrompt.HEIGHT - FDialog.INSETS); float gapBetweenButtons = FOptionPane.PADDING / 2; - float buttonHeight = FOptionPane.BUTTON_HEIGHT; float labelHeight = selectOrder.getAutoSizeBounds().height; - float listHeight = (maxHeight - 2 * labelHeight - buttonHeight - FOptionPane.PADDING - 2 * FDialog.INSETS) / 2; + float listHeight = (maxHeight - 2 * labelHeight - FOptionPane.PADDING) / 2; float addButtonWidth = addAllButton.getAutoSizeBounds().width * 1.2f; float addButtonHeight = listHeight / 2 - gapBetweenButtons; float listWidth = width - addButtonWidth - gapBetweenButtons; @@ -162,11 +157,6 @@ public class DualListBox extends FDialog { destList.setBounds(x + width - listWidth, y, listWidth, listHeight); y += listHeight + FOptionPane.PADDING; - float buttonWidth = (width - gapBetweenButtons) / 2; - okButton.setBounds(x, y, buttonWidth, buttonHeight); - x += buttonWidth + gapBetweenButtons; - autoButton.setBounds(x, y, buttonWidth, buttonHeight); - return maxHeight; } @@ -204,13 +194,13 @@ public class DualListBox extends FDialog { boolean canRemove = destList.getCount() != 0; boolean targetReached = anySize || targetRemainingSourcesMin <= sourceList.getCount() && targetRemainingSourcesMax >= sourceList.getCount(); - autoButton.setEnabled(targetRemainingSourcesMax == 0 && !targetReached); + setButtonEnabled(1, targetRemainingSourcesMax == 0 && !targetReached); addButton.setEnabled(canAdd); addAllButton.setEnabled(canAdd); removeButton.setEnabled(canRemove); removeAllButton.setEnabled(canRemove); - okButton.setEnabled(targetReached); + setButtonEnabled(0, targetReached); } private class ChoiceList extends FChoiceList { @@ -231,13 +221,13 @@ public class DualListBox extends FDialog { switch (keyCode) { case Keys.ENTER: case Keys.ESCAPE: //Enter and Escape should trigger either OK or Auto based on which is enabled - if (okButton.trigger()) { + if (getButton(0).trigger()) { return true; } - return autoButton.trigger(); + return getButton(1).trigger(); case Keys.SPACE: //Space should trigger OK button if enabled, //otherwise it should trigger first enabled button (default container behavior) - if (okButton.trigger()) { + if (getButton(0).trigger()) { return true; } break; diff --git a/forge-gui-mobile/src/forge/toolbox/FDialog.java b/forge-gui-mobile/src/forge/toolbox/FDialog.java index 97bbb70d5b1..fcbcf8ead88 100644 --- a/forge-gui-mobile/src/forge/toolbox/FDialog.java +++ b/forge-gui-mobile/src/forge/toolbox/FDialog.java @@ -1,52 +1,55 @@ package forge.toolbox; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; -import com.badlogic.gdx.math.Rectangle; import forge.Graphics; import forge.assets.FSkinColor; import forge.assets.FSkinFont; -import forge.assets.FSkinImage; import forge.assets.FSkinTexture; import forge.assets.FSkinColor.Colors; import forge.screens.FScreen; import forge.screens.match.MatchController; +import forge.screens.match.views.VPrompt; +import forge.toolbox.FEvent.FEventHandler; import forge.util.Utils; public abstract class FDialog extends FOverlay { - private static final FSkinFont TITLE_FONT = FSkinFont.get(12); - private static final FSkinColor TITLE_BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2); + public static final FSkinFont MSG_FONT = FSkinFont.get(12); + public static final FSkinColor MSG_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.9f); + public static final FSkinColor MSG_BACK_COLOR = FScreen.Header.BACK_COLOR.alphaColor(0.75f); + public static final float MSG_HEIGHT = MSG_FONT.getCapHeight() * 2.5f; private static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS); - public static final float TITLE_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.6f); - public static final float INSETS = Utils.scale(10); + private static float BORDER_THICKNESS = Utils.scale(1); + private static int openDialogCount = 0; public static boolean isDialogOpen() { return openDialogCount > 0; } - private Titlebar lblTitlebar; + private final VPrompt prompt; + private final int buttonCount; private float totalHeight; + private boolean hidden; - protected FDialog(String title) { - lblTitlebar = add(new Titlebar(title)); + protected FDialog(String title, int buttonCount0) { + title = title.replaceAll(" - ", "\n"); //breakup into lines + buttonCount = buttonCount0; + prompt = add(new VPrompt("", "", null, null)); + prompt.setMessage(title); } @Override protected final void doLayout(float width, float height) { - width -= 2 * INSETS; + float contentHeight = layoutAndGetHeight(width, height - VPrompt.HEIGHT - 2 * MSG_HEIGHT); + totalHeight = contentHeight + VPrompt.HEIGHT; - float contentHeight = layoutAndGetHeight(width, height - TITLE_HEIGHT - 2 * INSETS); - totalHeight = contentHeight + TITLE_HEIGHT; - float y = (height - totalHeight) / 2; + prompt.setBounds(0, height - VPrompt.HEIGHT, width, VPrompt.HEIGHT); - lblTitlebar.setBounds(INSETS, y, width, TITLE_HEIGHT); - - //shift all children into position below titlebar - float dy = lblTitlebar.getBottom(); + //shift all children into position + float dy = height - totalHeight; for (FDisplayObject child : getChildren()) { - if (child != lblTitlebar) { - child.setLeft(child.getLeft() + INSETS); + if (child != prompt) { child.setTop(child.getTop() + dy); } } @@ -67,10 +70,41 @@ public abstract class FDialog extends FOverlay { } protected abstract float layoutAndGetHeight(float width, float maxHeight); + + protected void initButton(int index, String text, FEventHandler command) { + FButton button = getButton(index); + if (button == null) { return; } + + button.setText(text); + button.setCommand(command); + button.setEnabled(true); + } + + protected FButton getButton(int index) { + switch (index) { + case 0: + return prompt.getBtnOk(); + case 1: + return prompt.getBtnCancel(); + default: + return null; + } + } + + public boolean isButtonEnabled(int index) { + FButton button = getButton(index); + return button != null ? button.isEnabled() : false; + } + + public void setButtonEnabled(int index, boolean enabled) { + FButton button = getButton(index); + if (button != null) { + button.setEnabled(enabled); + } + } private boolean isPointWithinDialog(float x, float y) { - Rectangle bounds = new Rectangle(lblTitlebar.getLeft(), lblTitlebar.getTop(), lblTitlebar.getWidth(), totalHeight); - return bounds.contains(x, y); + return y >= getHeight() - totalHeight; } @Override @@ -82,82 +116,30 @@ public abstract class FDialog extends FOverlay { protected void drawBackground(Graphics g) { super.drawBackground(g); - float x = lblTitlebar.getLeft(); - float y = lblTitlebar.getTop(); - float w = lblTitlebar.getWidth(); - float h = totalHeight; + float x = 0; + float y = getHeight() - totalHeight; + float w = getWidth(); + float h = totalHeight - VPrompt.HEIGHT; g.drawImage(FSkinTexture.BG_TEXTURE, x, y, w, h); g.fillRect(FScreen.TEXTURE_OVERLAY_COLOR, x, y, w, h); - - //draw custom background behind titlebar - g.fillRect(TITLE_BACK_COLOR, x, y, w, TITLE_HEIGHT); } @Override - protected void drawOverlay(Graphics g) { - super.drawOverlay(g); - - float x = lblTitlebar.getLeft(); - float y = lblTitlebar.getTop(); - float w = lblTitlebar.getWidth(); - float h = totalHeight; - - //draw border around dialog - g.drawRect(1, BORDER_COLOR, x, y, w, h); - - //draw bottom border of titlebar - y += TITLE_HEIGHT; - g.drawLine(1, BORDER_COLOR, x, y, x + w, y); - } - - private class Titlebar extends FLabel { - private Titlebar(String title) { - super(new FLabel.Builder().text(title) - .icon(FSkinImage.FAVICON.getTextureRegion() != null ? FSkinImage.FAVICON : null) //don't show icon if on SplashScreen - .font(TITLE_FONT).align(HAlignment.LEFT)); + public void drawOverlay(Graphics g) { + float w = getWidth(); + String message; + if (hidden) { + message = "Swipe up to show prompt again"; } - - @Override - public boolean pan(float x, float y, float deltaX, float deltaY, boolean moreVertical) { - for (FDisplayObject child : FDialog.this.getChildren()) { - child.setLeft(child.getLeft() + deltaX); - child.setTop(child.getTop() + deltaY); - } - return true; + else { + message = "Swipe down to temporarily hide prompt"; } + g.fillRect(FDialog.MSG_BACK_COLOR, 0, 0, w, MSG_HEIGHT); + g.drawText(message, FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, 0, w, MSG_HEIGHT, false, HAlignment.CENTER, true); - @Override - public boolean panStop(float x, float y) { - //ensure titlebar in view after stopping panning so it's accessible - float dx = 0; - float dy = 0; - float maxLeft = FDialog.this.getWidth() - lblTitlebar.getHeight(); - if (lblTitlebar.getLeft() > maxLeft) { - dx = maxLeft - lblTitlebar.getLeft(); - } - else { - float minRight = lblTitlebar.getHeight(); - if (lblTitlebar.getRight() < minRight) { - dx = minRight - lblTitlebar.getRight(); - } - } - float maxTop = FDialog.this.getHeight() - lblTitlebar.getHeight(); - if (lblTitlebar.getTop() > maxTop) { - dy = maxTop - lblTitlebar.getTop(); - } - else { - float minBottom = lblTitlebar.getHeight(); - if (lblTitlebar.getBottom() < minBottom) { - dy = minBottom - lblTitlebar.getBottom(); - } - } - if (dx != 0 || dy != 0) { - for (FDisplayObject child : FDialog.this.getChildren()) { - child.setLeft(child.getLeft() + dx); - child.setTop(child.getTop() + dy); - } - } - return true; - } + float y = getHeight() - totalHeight; + g.drawLine(BORDER_THICKNESS, BORDER_COLOR, 0, y, w, y); + y = prompt.getTop(); + g.drawLine(BORDER_THICKNESS, BORDER_COLOR, 0, y, w, y); } } diff --git a/forge-gui-mobile/src/forge/toolbox/FFileChooser.java b/forge-gui-mobile/src/forge/toolbox/FFileChooser.java index ae3c603e6ee..2361381854b 100644 --- a/forge-gui-mobile/src/forge/toolbox/FFileChooser.java +++ b/forge-gui-mobile/src/forge/toolbox/FFileChooser.java @@ -48,51 +48,8 @@ public class FFileChooser extends FDialog { private final FList lstFiles = add(new FileList()); private final FTextField txtFilename = add(new FilenameField()); - private final FButton btnNewFolder = add(new FButton("New Folder", new FEventHandler() { - @Override - public void handleEvent(FEvent e) { - final File dir = getCurrentDir(); - if (dir == null) { - FOptionPane.showErrorDialog("Cannot add new folder to invalid folder.", "Invalid Folder"); - return; - } - - FOptionPane.showInputDialog("Enter name for new folder:", "New Folder", new Callback() { - @Override - public void run(String result) { - if (StringUtils.isEmpty(result)) { return; } - - try { - File newDir = new File(dir, result); - if (newDir.mkdirs()) { - txtFilename.setText(newDir.getAbsolutePath()); - refreshFileList(); - return; - } - } - catch (Exception e) { - e.printStackTrace(); - } - FOptionPane.showErrorDialog("\"" + result + "\" is not a valid folder name.", "Invalid Name"); - } - }); - } - })); - private final FButton btnOK = add(new FButton("OK", new FEventHandler() { - @Override - public void handleEvent(FEvent e) { - activateSelectedFile(true); - } - })); - private final FButton btnCancel = add(new FButton("Cancel", new FEventHandler() { - @Override - public void handleEvent(FEvent e) { - hide(); - } - })); - private FFileChooser(String title0, ChoiceType choiceType0, String defaultFilename0, String baseDir0, Callback callback0) { - super(title0); + super(title0, 3); choiceType = choiceType0; if (choiceType == ChoiceType.GetDirectory) { if (defaultFilename0.endsWith(File.separator)) { //if getting directory, don't end with a slash @@ -107,6 +64,50 @@ public class FFileChooser extends FDialog { refreshFileList(); } }); + + initButton(0, "OK", new FEventHandler() { + @Override + public void handleEvent(FEvent e) { + activateSelectedFile(true); + } + }); + initButton(1, "New Folder", new FEventHandler() { + @Override + public void handleEvent(FEvent e) { + final File dir = getCurrentDir(); + if (dir == null) { + FOptionPane.showErrorDialog("Cannot add new folder to invalid folder.", "Invalid Folder"); + return; + } + + FOptionPane.showInputDialog("Enter name for new folder:", "New Folder", new Callback() { + @Override + public void run(String result) { + if (StringUtils.isEmpty(result)) { return; } + + try { + File newDir = new File(dir, result); + if (newDir.mkdirs()) { + txtFilename.setText(newDir.getAbsolutePath()); + refreshFileList(); + return; + } + } + catch (Exception e) { + e.printStackTrace(); + } + FOptionPane.showErrorDialog("\"" + result + "\" is not a valid folder name.", "Invalid Name"); + } + }); + } + }); + initButton(2, "Cancel", new FEventHandler() { + @Override + public void handleEvent(FEvent e) { + hide(); + } + }); + baseDir = baseDir0; callback = callback0; refreshFileList(); @@ -117,22 +118,10 @@ public class FFileChooser extends FDialog { float padding = FOptionPane.PADDING; float w = width - 2 * padding; - //layout buttons - float gapBetweenButtons = padding / 2; - float buttonWidth = (w - gapBetweenButtons * 2) / 3; - float buttonHeight = FOptionPane.BUTTON_HEIGHT; - float x = padding; - float y = maxHeight - FOptionPane.GAP_BELOW_BUTTONS - buttonHeight; - btnNewFolder.setBounds(x, y, buttonWidth, buttonHeight); - x += buttonWidth + gapBetweenButtons; - btnOK.setBounds(x, y, buttonWidth, buttonHeight); - x += buttonWidth + gapBetweenButtons; - btnCancel.setBounds(x, y, buttonWidth, buttonHeight); - float fieldHeight = txtFilename.getHeight(); - float listHeight = y - fieldHeight - 3 * padding; - x = padding; - y = padding; + float listHeight = maxHeight - fieldHeight - 2 * padding; + float x = padding; + float y = padding; txtFilename.setBounds(x, y, w, fieldHeight); y += fieldHeight + padding; lstFiles.setBounds(x, y, w, listHeight); diff --git a/forge-gui-mobile/src/forge/toolbox/FOptionPane.java b/forge-gui-mobile/src/forge/toolbox/FOptionPane.java index 47adbd05d2d..9f95e0a8444 100644 --- a/forge-gui-mobile/src/forge/toolbox/FOptionPane.java +++ b/forge-gui-mobile/src/forge/toolbox/FOptionPane.java @@ -28,14 +28,9 @@ public class FOptionPane extends FDialog { public static final FSkinImage ERROR_ICON = FSkinImage.ERROR; public static final float PADDING = Utils.scale(10); - public static final float GAP_BETWEEN_BUTTONS = Utils.scale(3); - public static final float GAP_BELOW_BUTTONS = PADDING * 0.5f; - public static final float BUTTON_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f; - public static final float MIN_BUTTON_WIDTH = Utils.scale(120); public static float getMaxDisplayObjHeight() { - return Forge.getCurrentScreen().getHeight() - 2 * VPrompt.HEIGHT - FDialog.TITLE_HEIGHT - - 2 * PADDING - BUTTON_HEIGHT - GAP_BELOW_BUTTONS; + return Forge.getCurrentScreen().getHeight() - VPrompt.HEIGHT - 2 * FDialog.MSG_HEIGHT; } public static void showMessageDialog(String message) { @@ -193,13 +188,12 @@ public class FOptionPane extends FDialog { private final FLabel lblIcon; private final FTextArea prompt; protected final FDisplayObject displayObj; - private final FButton[] buttons; private final Callback callback; private final int defaultOption; private final boolean centerIcon; public FOptionPane(String message, String title, FImage icon, FDisplayObject displayObj0, String[] options, int defaultOption0, final Callback callback0) { - super(title); + super(title, options.length); if (icon != null) { centerIcon = icon.getWidth() >= 100; //for large icon, center in dialog @@ -231,16 +225,14 @@ public class FOptionPane extends FDialog { callback = callback0; - int optionCount = options.length; - buttons = new FButton[optionCount]; - for (int i = 0; i < optionCount; i++) { + for (int i = 0; i < options.length; i++) { final int option = i; - buttons[i] = add(new FButton(options[i], new FEventHandler() { + initButton(i, options[i], new FEventHandler() { @Override public void handleEvent(FEvent e) { setResult(option); } - })); + }); } defaultOption = defaultOption0; } @@ -252,24 +244,12 @@ public class FOptionPane extends FDialog { } } - public boolean isButtonEnabled(int index) { - return buttons[index].isEnabled(); - } - - public void setButtonEnabled(int index, boolean enabled) { - buttons[index].setEnabled(enabled); - } - - protected boolean padDisplayObject() { - return true; - } - @Override protected float layoutAndGetHeight(float width, float maxHeight) { float x = PADDING; float y = PADDING; - float maxPromptHeight = maxHeight - 2 * PADDING - BUTTON_HEIGHT - GAP_BELOW_BUTTONS; + float maxPromptHeight = maxHeight - 2 * PADDING; if (displayObj != null) { maxPromptHeight -= displayObj.getHeight(); } @@ -314,40 +294,10 @@ public class FOptionPane extends FDialog { } if (displayObj != null) { - if (padDisplayObject()) { - displayObj.setBounds(x, y, width - 2 * x, displayObj.getHeight()); - y += displayObj.getHeight() + PADDING; - } - else { - displayObj.setBounds(x - PADDING, y - PADDING, width, displayObj.getHeight()); - y += displayObj.getHeight(); - } + displayObj.setBounds(x - PADDING, y - PADDING, width, displayObj.getHeight()); + y += displayObj.getHeight() - PADDING; } - - //determine size for and position buttons - float maxButtonWidth = 0; - for (FButton btn : buttons) { - float buttonWidth = btn.getAutoSizeBounds().width; - if (buttonWidth > maxButtonWidth) { - maxButtonWidth = buttonWidth; - } - } - float buttonWidth = Math.max(maxButtonWidth, MIN_BUTTON_WIDTH); //account for margins and enforce minimum width - float dx = buttonWidth + GAP_BETWEEN_BUTTONS; - float totalButtonWidth = dx * buttons.length - GAP_BETWEEN_BUTTONS; - - x = (width - totalButtonWidth) / 2; - if (x < PADDING) { //reduce button width if not enough room for buttons - buttonWidth = (width - 2 * PADDING - (buttons.length - 1) * GAP_BETWEEN_BUTTONS) / (float)buttons.length; - x = PADDING; - dx = buttonWidth + GAP_BETWEEN_BUTTONS; - } - for (FButton btn : buttons) { - btn.setBounds(x, y, buttonWidth, BUTTON_HEIGHT); - x += dx; - } - - return y + BUTTON_HEIGHT + GAP_BELOW_BUTTONS; + return y; } @Override @@ -363,8 +313,8 @@ public class FOptionPane extends FDialog { case Keys.BACK: if (Forge.endKeyInput()) { return true; } - if (isButtonEnabled(buttons.length - 1)) { - setResult(buttons.length - 1); //set result to final option on Escape or Back + if (isButtonEnabled(1)) { + setResult(1); //set result to final option on Escape or Back } return true; } diff --git a/forge-gui-mobile/src/forge/toolbox/ListChooser.java b/forge-gui-mobile/src/forge/toolbox/ListChooser.java index 5baa79d5aec..f2517398b90 100644 --- a/forge-gui-mobile/src/forge/toolbox/ListChooser.java +++ b/forge-gui-mobile/src/forge/toolbox/ListChooser.java @@ -21,6 +21,7 @@ package forge.toolbox; import com.google.common.base.Function; import forge.FThreads; +import forge.Graphics; import forge.assets.FSkinFont; import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; @@ -106,7 +107,7 @@ public class ListChooser extends FContainer { String[] options; if (minChoices == 0) { - options = new String[] {"OK","Cancel"}; + options = new String[] {"OK", "Cancel"}; } else { options = new String[] {"OK"}; @@ -179,8 +180,10 @@ public class ListChooser extends FContainer { protected void doLayout(float width, float height) { float y = 0; if (txtSearch != null) { - txtSearch.setBounds(0, 0, width, txtSearch.getHeight()); - y += txtSearch.getHeight() * 1.25f; + float padding = txtSearch.getHeight() * 0.25f; + y += padding; + txtSearch.setBounds(0, y, width, txtSearch.getHeight()); + y += txtSearch.getHeight() + padding; } lstChoices.setBounds(0, y, width, height - y); } @@ -215,5 +218,10 @@ public class ListChooser extends FContainer { protected void onCompactModeChange() { updateHeight(); //update height and scroll bounds based on compact mode change } + + @Override + public void drawOverlay(Graphics g) { + //don't draw border + } } }