diff --git a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java index 30667458..ee71fcfc 100644 --- a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java +++ b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java @@ -1,7 +1,7 @@ package com.mercury.platform.core; public class MercuryConstants { - public static final String APP_VERSION = "1.3.3"; + public static final String APP_VERSION = "1.3.4"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java index ea87b81f..33ad4184 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java @@ -7,6 +7,7 @@ import com.mercury.platform.ui.components.fields.style.MercuryComboBoxUI; import com.mercury.platform.ui.components.fields.style.MercuryScrollBarUI; import com.mercury.platform.ui.components.panel.misc.ToggleCallback; +import com.mercury.platform.ui.manager.FramesManager; import com.mercury.platform.ui.misc.AppThemeColor; import com.mercury.platform.ui.misc.MercuryStoreUI; import lombok.AllArgsConstructor; @@ -31,6 +32,9 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.net.URL; import java.nio.file.Files; import java.text.NumberFormat; @@ -224,7 +228,6 @@ protected void paintBorder(Graphics g) { super.paintBorder(g); } } - @Override public JToolTip createToolTip() { JToolTip tip = ComponentsFactory.this.createTooltip(); @@ -232,17 +235,9 @@ public JToolTip createToolTip() { return tip; } - @Override - public Point getToolTipLocation(MouseEvent event) { - return super.getToolTipLocation(event); - //return event.getLocationOnScreen(); - } - - }; - button.setDoubleBuffered(true); button.setBackground(background); - button.setFocusPainted(false); + button.addChangeListener(e -> { if (!button.getModel().isPressed()) { button.setBackground(button.getBackground()); @@ -251,7 +246,13 @@ public Point getToolTipLocation(MouseEvent event) { if (tooltip.length() > 0) { button.setToolTipText(tooltip); } + + button.setFocusPainted(false); + + button.setFocusable(true); + button.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + button.addActionListener(action -> { MercuryStoreCore.soundSubject.onNext(SoundType.CLICKS); button.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); @@ -266,7 +267,6 @@ public void mouseEntered(MouseEvent e) { BorderFactory.createLineBorder(AppThemeColor.ADR_SELECTED_BORDER), BorderFactory.createEmptyBorder(3, 3, 3, 3))); button.setCursor(new Cursor(Cursor.HAND_CURSOR)); - } @Override @@ -274,7 +274,6 @@ public void mouseExited(MouseEvent e) { button.setBorder(prevBorder); button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } - }); button.setBorder(BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT, 4)); @@ -304,7 +303,7 @@ public JToolTip createTooltip() { JToolTip toolTip = new JToolTip(); toolTip.setBackground(AppThemeColor.SETTINGS_BG); toolTip.setForeground(AppThemeColor.TEXT_DEFAULT); - toolTip.setFont(getFont(FontStyle.REGULAR, 18)); + toolTip.setFont(getFont(FontStyle.REGULAR, 16)); toolTip.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER)); return toolTip; } @@ -902,47 +901,47 @@ public JMenuItem getMenu(String text) { return menu; } - @EqualsAndHashCode(callSuper = true) - @Data - private class TooltipMouseListener extends MouseAdapter { - private String tooltip; - private Timer tooltipTimer; - private Timer tempTimer; - private boolean fired = false; - - public TooltipMouseListener (String tooltip) { - this.tooltip = tooltip; - } - - @Override - public void mouseEntered(MouseEvent e) { - fired = false; - this.tooltipTimer = new Timer(700, action -> { - MercuryStoreCore.tooltipSubject.onNext(tooltip); - fired = true; - this.tooltipTimer.stop(); - }); - this.tooltipTimer.start(); - } - - @Override - public void mouseExited(MouseEvent e) { - this.tooltipTimer.stop(); - if (fired) { - MercuryStoreCore.tooltipSubject.onNext(null); - } - } - - @Override - public void mousePressed(MouseEvent e) { - tempTimer = new Timer(100, action -> { - this.tooltipTimer.stop(); - if (fired) { - MercuryStoreCore.tooltipSubject.onNext(null); - } - tempTimer.stop(); - }); - tempTimer.start(); - } - } +// @EqualsAndHashCode(callSuper = true) +// @Data +// private class TooltipMouseListener extends MouseAdapter { +// private String tooltip; +// private Timer tooltipTimer; +// private Timer tempTimer; +// private boolean fired = false; +// +// public TooltipMouseListener (String tooltip) { +// this.tooltip = tooltip; +// } +// +// @Override +// public void mouseEntered(MouseEvent e) { +// fired = false; +// this.tooltipTimer = new Timer(700, action -> { +// MercuryStoreCore.tooltipSubject.onNext(tooltip); +// fired = true; +// this.tooltipTimer.stop(); +// }); +// this.tooltipTimer.start(); +// } +// +// @Override +// public void mouseExited(MouseEvent e) { +// this.tooltipTimer.stop(); +// if (fired) { +// MercuryStoreCore.tooltipSubject.onNext(null); +// } +// } +// +// @Override +// public void mousePressed(MouseEvent e) { +// tempTimer = new Timer(100, action -> { +// this.tooltipTimer.stop(); +// if (fired) { +// MercuryStoreCore.tooltipSubject.onNext(null); +// } +// tempTimer.stop(); +// }); +// tempTimer.start(); +// } +// } } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/ScannerNotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/ScannerNotificationPanel.java index 4c62f1c8..22921c64 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/ScannerNotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/ScannerNotificationPanel.java @@ -70,7 +70,7 @@ private JPanel getHeader() { tradeButton.addActionListener(e -> this.controller.performOfferTrade()); JButton leaveButton = componentsFactory.getIconButton(IconConst.LEAVE, 16, AppThemeColor.MSG_HEADER, TooltipConstants.LEAVE); leaveButton.addActionListener(e -> { - this.controller.performLeave(this.notificationConfig.get().getPlayerNickname()); + this.controller.performLeave(); if (this.notificationConfig.get().isDismissAfterLeave()) { this.controller.performHide(); } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/NotificationScannerController.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/NotificationScannerController.java index 157ecfd9..198eb036 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/NotificationScannerController.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/NotificationScannerController.java @@ -24,7 +24,7 @@ public void performInvite() { } @Override - public void performLeave(String nickName) { + public void performLeave() { MercuryStoreCore.chatCommandSubject.onNext("/leave"); } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/ScannerPanelController.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/ScannerPanelController.java index de0b6efc..4f86e50e 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/ScannerPanelController.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/ScannerPanelController.java @@ -5,7 +5,7 @@ public interface ScannerPanelController extends NotificationController { void performInvite(); - void performLeave(String nickName); + void performLeave(); void performWhoIs(); } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/stub/ScannerStubController.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/stub/ScannerStubController.java index 605d5276..03f218ef 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/stub/ScannerStubController.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/controller/stub/ScannerStubController.java @@ -42,7 +42,7 @@ public void performInvite() { } @Override - public void performLeave(String nickName) { + public void performLeave() { } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java index a7226e4e..e94a01b9 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java @@ -114,15 +114,16 @@ private JPanel getGeneralPanel() { limitPanel.add(limitLabel, BorderLayout.LINE_START); limitPanel.add(limitSlider, BorderLayout.CENTER); propertiesPanel.add(limitPanel); - propertiesPanel.add(this.componentsFactory.getTextLabel("Your nickname(for leave option):", FontStyle.REGULAR, 16)); - JTextField nickNameField = this.componentsFactory.getTextField(this.generalSnapshot.getPlayerNickname(), FontStyle.DEFAULT, 15f); - nickNameField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - generalSnapshot.setPlayerNickname(nickNameField.getText()); - } - }); - propertiesPanel.add(nickNameField); + //TODO: Remove after testing if nickname for leave group is no longer needed +// propertiesPanel.add(this.componentsFactory.getTextLabel("Your nickname(for leave option):", FontStyle.REGULAR, 16)); +// JTextField nickNameField = this.componentsFactory.getTextField(this.generalSnapshot.getPlayerNickname(), FontStyle.DEFAULT, 15f); +// nickNameField.addFocusListener(new FocusAdapter() { +// @Override +// public void focusLost(FocusEvent e) { +// generalSnapshot.setPlayerNickname(nickNameField.getText()); +// } +// }); +// propertiesPanel.add(nickNameField); root.add(this.componentsFactory.wrapToSlide(propertiesPanel, AppThemeColor.ADR_BG, 2, 0, 2, 2), BorderLayout.PAGE_START); return root; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java b/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java index a2aa3c79..86142f0a 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java @@ -53,6 +53,8 @@ public class FramesManager implements AsSubscriber { private AdrManager adrManager; private TrayIcon trayIcon; + public AbstractOverlaidFrame taskBarFrame; + private FramesManager() { this.framesMap = new HashMap<>(); this.locationCommander = new SetUpLocationCommander(); @@ -76,7 +78,7 @@ public void start() { }); baseInitThread.start(); - AbstractOverlaidFrame taskBarFrame = new TaskBarFrame(); + taskBarFrame = new TaskBarFrame(); this.locationCommander.addFrame((AbstractMovableComponentFrame) taskBarFrame); this.scaleCommander.addFrame((AbstractScalableComponentFrame) taskBarFrame); diff --git a/app-ui/src/main/resources/notes/patch/patch-notes-new.json b/app-ui/src/main/resources/notes/patch/patch-notes-new.json index b4c5a4b6..f4f31965 100644 --- a/app-ui/src/main/resources/notes/patch/patch-notes-new.json +++ b/app-ui/src/main/resources/notes/patch/patch-notes-new.json @@ -1,4 +1,17 @@ [ + { + "version": "1.3.4", + "minorChanges": [ + { + "changed": "Leave button was changed that it no longer requires player name to be set up in configuration" + } + ], + "fix": [ + { + "changed": "Fixed all tooltips that didn't work" + } + ] + }, { "version": "1.3.3", "features": [ diff --git a/app/src/main/java/com/mercury/platform/AppMain.java b/app/src/main/java/com/mercury/platform/AppMain.java index 725afd79..42b9bf1a 100644 --- a/app/src/main/java/com/mercury/platform/AppMain.java +++ b/app/src/main/java/com/mercury/platform/AppMain.java @@ -38,6 +38,7 @@ public static void main(String[] args) { System.setProperty("sun.java2d.d3d", "false"); System.setProperty("jna.nosys", "true"); + UIManager.put("ToolTipManager.enableToolTipMode", "allWindows"); boolean standalone = BooleanUtils.toBoolean(System.getProperty("standalone")); boolean dev = BooleanUtils.toBoolean(System.getProperty("dev")); boolean hideLoadingIcon = BooleanUtils.toBoolean(System.getProperty("hideLoadingIcon")); diff --git a/release_files/release_config.xml b/release_files/release_config.xml index 4daadd61..a0deac3f 100644 --- a/release_files/release_config.xml +++ b/release_files/release_config.xml @@ -30,12 +30,12 @@ -XX:+UseG1GC - 1.3.3.0 - 1.3.3 + 1.3.4.0 + 1.3.4 MercuryTrade Morph21 - 1.3.3.0 - 1.3.3 + 1.3.4.0 + 1.3.4 MercuryTrade Morph MercuryTrade