diff --git a/app-core/src/main/java/com/mercury/platform/shared/config/configration/impl/NotificationConfigurationService.java b/app-core/src/main/java/com/mercury/platform/shared/config/configration/impl/NotificationConfigurationService.java index d7db23f6..a6b98d1f 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/config/configration/impl/NotificationConfigurationService.java +++ b/app-core/src/main/java/com/mercury/platform/shared/config/configration/impl/NotificationConfigurationService.java @@ -28,6 +28,12 @@ public NotificationSettingsDescriptor getDefault() { defaultOutButtons.add(new ResponseButtonDescriptor(0, false, "thanks", "thanks", new HotKeyDescriptor())); notificationSettingsDescriptor.setButtons(defaultButtons); notificationSettingsDescriptor.setOutButtons(defaultOutButtons); + + List autoCloseTriggers = new ArrayList<>(); + autoCloseTriggers.add("This player has DND mode enabled"); + autoCloseTriggers.add("That character is not online."); + autoCloseTriggers.add("This player is AFK."); + notificationSettingsDescriptor.setAutoCloseTriggers(autoCloseTriggers); return notificationSettingsDescriptor; } @@ -49,6 +55,11 @@ public void validate() { if (this.get().getOutButtons().size() == 0) { this.get().getOutButtons().add(new ResponseButtonDescriptor(0, false, "thanks", "thanks", new HotKeyDescriptor())); } + if (this.get().getAutoCloseTriggers().size() == 0) { + this.get().getAutoCloseTriggers().add("This player has DND mode enabled"); + this.get().getAutoCloseTriggers().add("That character is not online."); + this.get().getAutoCloseTriggers().add("This player is AFK."); + } } @Override diff --git a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/HotKeyType.java b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/HotKeyType.java index 2abe067a..812366c9 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/HotKeyType.java +++ b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/HotKeyType.java @@ -11,18 +11,33 @@ public enum HotKeyType implements Serializable { public String getIconPath() { return "app/trade.png"; } + + @Override + public String getTooltip() { + return "Offer trade"; + } }, N_OPEN_CHAT { @Override public String getIconPath() { return "app/openChat.png"; } + + @Override + public String getTooltip() { + return "Message this player"; + } }, N_CLOSE_NOTIFICATION { @Override public String getIconPath() { return "app/close.png"; } + + @Override + public String getTooltip() { + return "Close notification"; + } }, //Incoming notification N_INVITE_PLAYER { @@ -30,30 +45,55 @@ public String getIconPath() { public String getIconPath() { return "app/invite.png"; } + + @Override + public String getTooltip() { + return "Invite player"; + } }, N_KICK_PLAYER { @Override public String getIconPath() { return "app/kick.png"; } + + @Override + public String getTooltip() { + return "Kick player"; + } }, N_STILL_INTERESTING { @Override public String getIconPath() { return "app/still-interesting.png"; } + + @Override + public String getTooltip() { + return "Still interested button"; + } }, N_REPEAT_MESSAGE { @Override public String getIconPath() { return "app/reload-history.png"; } + + @Override + public String getTooltip() { + return "Repeat message"; + } }, N_SWITCH_CHAT { @Override public String getIconPath() { return "app/chat_history.png"; } + + @Override + public String getTooltip() { + return "Chat history"; + } }, //Outgoing/scanner notification N_VISITE_HIDEOUT { @@ -61,18 +101,33 @@ public String getIconPath() { public String getIconPath() { return "app/visiteHideout.png"; } + + @Override + public String getTooltip() { + return "Visit player hideout"; + } }, N_LEAVE { @Override public String getIconPath() { return "app/leave.png"; } + + @Override + public String getTooltip() { + return "Leave from party"; + } }, N_BACK_TO_HIDEOUT { @Override public String getIconPath() { return "app/backToHideout.png"; } + + @Override + public String getTooltip() { + return null; + } }, //scanner N_QUICK_RESPONSE { @@ -80,18 +135,33 @@ public String getIconPath() { public String getIconPath() { return "app/chat_scanner_response.png"; } + + @Override + public String getTooltip() { + return "Quick response"; + } }, T_TO_HIDEOUT { @Override public String getIconPath() { return "app/hideout.png"; } + + @Override + public String getTooltip() { + return "To hideout"; + } }, T_DND { @Override public String getIconPath() { return "app/visible-dnd-mode.png"; } + + @Override + public String getTooltip() { + return "Dnd"; + } }; public static boolean contains(HotKeyType entry) { @@ -102,4 +172,6 @@ public static boolean contains(HotKeyType entry) { } public abstract String getIconPath(); + + public abstract String getTooltip(); } diff --git a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java index 34f38e49..340bfde0 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java +++ b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java @@ -21,4 +21,5 @@ public class NotificationSettingsDescriptor implements Serializable { private List buttons = new ArrayList<>(); private List outButtons = new ArrayList<>(); private String playerNickname = "Set up your nickname in settings"; + private List autoCloseTriggers = new ArrayList<>(); } 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 8df04ae4..5e14e972 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 @@ -410,13 +410,14 @@ public JLabel getIconLabel(URL url, int size) { return iconLabel; } - public JLabel getIconLabel(String iconPath, int size, String tooltip) { + public JLabel getIconLabel(String iconPath, int size, int alignment, String tooltip) { JLabel iconLabel = new JLabel(); try { iconLabel.setIcon(getIcon(iconPath, (int) (scale * size))); } catch (Exception e) { return getTextLabel(StringUtils.substringBetween(iconPath, "/", ".")); } + iconLabel.setHorizontalAlignment(alignment); iconLabel.addMouseListener(new TooltipMouseListener(tooltip)); return iconLabel; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java index 44960ef1..825afc55 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java @@ -105,7 +105,7 @@ public void paint(Graphics g) { protected JPanel getTimePanel() { JPanel root = new JPanel(new BorderLayout()); - root.setPreferredSize(new Dimension((int) (46 * this.componentsFactory.getScale()), (int) (26 * this.componentsFactory.getScale()))); + root.setPreferredSize(new Dimension((int) (38 * this.componentsFactory.getScale()), (int) (26 * this.componentsFactory.getScale()))); root.setBackground(AppThemeColor.MSG_HEADER); JLabel timeLabel = componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_MISC, TextAlignment.CENTER, 14, "0s"); Timer timeAgo = new Timer(1000, new ActionListener() { @@ -114,7 +114,15 @@ protected JPanel getTimePanel() { @Override public void actionPerformed(ActionEvent e) { seconds++; - String labelText = seconds + "s "; + String labelText = seconds + "s"; + if (seconds > 59) { + int minutes = seconds / 60; + if (minutes > 59) { + labelText = minutes / 60 + "h"; + } else { + labelText = seconds / 60 + "m"; + } + } timeLabel.setText(labelText); } }); 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 fcc90769..5c5c1e1e 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 @@ -58,6 +58,11 @@ private JPanel getHeader() { interactionPanel.setBackground(AppThemeColor.MSG_HEADER); JButton inviteMeButton = componentsFactory.getIconButton("app/chat_scanner_response.png", 16, AppThemeColor.MSG_HEADER, TooltipConstants.QUICK_RESPONSE); inviteMeButton.addActionListener(e -> this.controller.performResponse(this.config.get().getResponseMessage())); + JButton inviteButton = componentsFactory.getIconButton("app/invite.png", 15, AppThemeColor.MSG_HEADER, TooltipConstants.INVITE); + inviteButton.addActionListener(e -> { + this.controller.performInvite(); + root.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER_SELECTED_BORDER)); + }); JButton visiteHideout = componentsFactory.getIconButton("app/visiteHideout.png", 16, AppThemeColor.MSG_HEADER, TooltipConstants.VISIT_HO); visiteHideout.addActionListener(e -> this.controller.visitHideout()); JButton tradeButton = componentsFactory.getIconButton("app/trade.png", 15, AppThemeColor.MSG_HEADER, TooltipConstants.TRADE); @@ -76,6 +81,7 @@ private JPanel getHeader() { this.controller.performHide(); }); interactionPanel.add(inviteMeButton); + interactionPanel.add(inviteButton); interactionPanel.add(visiteHideout); interactionPanel.add(tradeButton); interactionPanel.add(leaveButton); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeIncNotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeIncNotificationPanel.java index 2b9e061e..30cbc1bf 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeIncNotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeIncNotificationPanel.java @@ -3,23 +3,17 @@ import com.mercury.platform.shared.config.descriptor.HotKeyPair; import com.mercury.platform.shared.config.descriptor.HotKeyType; import com.mercury.platform.shared.entity.message.TradeNotificationDescriptor; -import com.mercury.platform.shared.store.MercuryStoreCore; import com.mercury.platform.ui.components.fields.font.FontStyle; import com.mercury.platform.ui.components.fields.font.TextAlignment; import com.mercury.platform.ui.components.panel.notification.controller.IncomingPanelController; import com.mercury.platform.ui.misc.AppThemeColor; import com.mercury.platform.ui.misc.TooltipConstants; -import rx.Subscription; import javax.swing.*; import java.awt.*; public abstract class TradeIncNotificationPanel extends TradeNotificationPanel { - private JLabel nicknameLabel; - private Subscription playerJoinSubscription; - private Subscription playerLeaveSubscription; - protected JPanel getHeader() { JPanel root = new JPanel(new BorderLayout()); root.setBackground(AppThemeColor.MSG_HEADER); @@ -29,8 +23,10 @@ protected JPanel getHeader() { this.nicknameLabel = this.componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_NICKNAME, TextAlignment.LEFTOP, 15f, this.getNicknameText()); nicknameLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 5)); nickNamePanel.add(this.getExpandButton(), BorderLayout.LINE_START); - nickNamePanel.add(this.nicknameLabel, BorderLayout.CENTER); - nickNamePanel.add(this.getForPanel("app/incoming_arrow.png"), BorderLayout.LINE_END); + JPanel headerPanel = this.componentsFactory.getJPanel(new GridLayout(1, 0, 3, 0), AppThemeColor.MSG_HEADER); + headerPanel.add(this.nicknameLabel); + headerPanel.add(this.getForPanel("app/incoming_arrow.png")); + nickNamePanel.add(headerPanel, BorderLayout.CENTER); root.add(nickNamePanel, BorderLayout.CENTER); JPanel opPanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.MSG_HEADER); @@ -79,27 +75,6 @@ protected JPanel getHeader() { return root; } - @Override - public void subscribe() { - super.subscribe(); - this.playerJoinSubscription = MercuryStoreCore.playerJoinSubject.subscribe(nickname -> { - if (this.data.getWhisperNickname().equals(nickname)) { - this.nicknameLabel.setForeground(AppThemeColor.TEXT_SUCCESS); - } - }); - this.playerLeaveSubscription = MercuryStoreCore.playerLeftSubject.subscribe(nickname -> { - if (this.data.getWhisperNickname().equals(nickname)) { - this.nicknameLabel.setForeground(AppThemeColor.TEXT_DISABLE); - } - }); - } - - @Override - public void onViewDestroy() { - super.onViewDestroy(); - this.playerLeaveSubscription.unsubscribe(); - this.playerJoinSubscription.unsubscribe(); - } protected abstract JButton getStillInterestedButton(); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeNotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeNotificationPanel.java index 9b4c0729..633f60fa 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeNotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeNotificationPanel.java @@ -23,8 +23,11 @@ public abstract class TradeNotificationPanel extends NotificationPanel { protected JPanel responseButtonsPanel; - private Subscription chatSubscription; + protected JLabel nicknameLabel; + private Subscription chatSubscription; + private Subscription playerJoinSubscription; + private Subscription playerLeaveSubscription; @Override public void onViewInit() { super.onViewInit(); @@ -100,11 +103,16 @@ public void subscribe() { this.chatSubscription = MercuryStoreCore.plainMessageSubject.subscribe(message -> { if (this.data.getWhisperNickname().equals(message.getNickName())) { this.data.getRelatedMessages().add(message); - if (message.getMessage().contains("This player has DND mode enabled") - || message.getMessage().contains("That character is not online.") - || message.getMessage().contains("This player is AFK.")) { - this.controller.performHide(); - } + } + }); + this.playerJoinSubscription = MercuryStoreCore.playerJoinSubject.subscribe(nickname -> { + if (this.data.getWhisperNickname().equals(nickname)) { + this.nicknameLabel.setForeground(AppThemeColor.TEXT_SUCCESS); + } + }); + this.playerLeaveSubscription = MercuryStoreCore.playerLeftSubject.subscribe(nickname -> { + if (this.data.getWhisperNickname().equals(nickname)) { + this.nicknameLabel.setForeground(AppThemeColor.TEXT_DISABLE); } }); } @@ -113,6 +121,8 @@ public void subscribe() { public void onViewDestroy() { super.onViewDestroy(); this.chatSubscription.unsubscribe(); + this.playerLeaveSubscription.unsubscribe(); + this.playerJoinSubscription.unsubscribe(); } protected JLabel getHistoryButton() { @@ -145,11 +155,11 @@ protected JPanel getForPanel(String signIconPath) { JPanel forPanel = new JPanel(new BorderLayout()); forPanel.setBackground(AppThemeColor.MSG_HEADER); JLabel separator = componentsFactory.getIconLabel(signIconPath, 16); - forPanel.add(separator, BorderLayout.CENTER); + forPanel.add(separator, BorderLayout.LINE_START); separator.setHorizontalAlignment(SwingConstants.CENTER); JPanel currencyPanel = this.getCurrencyPanel(this.data.getCurCount(), this.data.getCurrency()); if (currencyPanel != null) { - forPanel.add(currencyPanel, BorderLayout.LINE_END); + forPanel.add(currencyPanel, BorderLayout.CENTER); } return forPanel; } @@ -163,13 +173,13 @@ protected JPanel getCurrencyPanel(Double curCount, String curIconPath) { } if (!Objects.equals(curCountStr, "") && curIconPath != null) { JLabel currencyLabel = componentsFactory.getIconLabel("currency/" + curIconPath + ".png", 26); - JPanel curPanel = new JPanel(new BorderLayout()); + JPanel curPanel = this.componentsFactory.getJPanel(new GridLayout(1, 0, 4, 0), AppThemeColor.MSG_HEADER); + curPanel.setAlignmentX(SwingConstants.LEFT); curPanel.setPreferredSize(new Dimension((int) (this.componentsFactory.getScale() * 70), (int) (this.componentsFactory.getScale() * 26))); - curPanel.setBackground(AppThemeColor.MSG_HEADER); JLabel countLabel = this.componentsFactory.getTextLabel(curCountStr, FontStyle.BOLD, 17f); countLabel.setHorizontalAlignment(SwingConstants.RIGHT); - curPanel.add(countLabel, BorderLayout.CENTER); - curPanel.add(currencyLabel, BorderLayout.LINE_END); + curPanel.add(countLabel); + curPanel.add(currencyLabel); return curPanel; } return null; diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeOutNotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeOutNotificationPanel.java index bf7eec83..5aaeab7e 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeOutNotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/TradeOutNotificationPanel.java @@ -9,6 +9,7 @@ import com.mercury.platform.ui.components.panel.notification.controller.OutgoingPanelController; import com.mercury.platform.ui.misc.AppThemeColor; import com.mercury.platform.ui.misc.TooltipConstants; +import org.apache.commons.lang3.StringUtils; import rx.Subscription; import javax.swing.*; @@ -16,9 +17,7 @@ public abstract class TradeOutNotificationPanel extends TradeNotificationPanel { - private JLabel nicknameLabel; - private Subscription playerJoinSubscription; - private Subscription playerLeaveSubscription; + private Subscription autoCloseSubscription; @Override protected JPanel getHeader() { @@ -28,8 +27,10 @@ protected JPanel getHeader() { JPanel nickNamePanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.MSG_HEADER); this.nicknameLabel = this.componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_NICKNAME, TextAlignment.LEFTOP, 15f, this.data.getWhisperNickname()); nickNamePanel.add(this.getExpandButton(), BorderLayout.LINE_START); - nickNamePanel.add(this.nicknameLabel, BorderLayout.CENTER); - nickNamePanel.add(this.getForPanel("app/outgoing_arrow.png"), BorderLayout.LINE_END); + JPanel headerPanel = this.componentsFactory.getJPanel(new GridLayout(1, 0, 3, 0), AppThemeColor.MSG_HEADER); + headerPanel.add(this.nicknameLabel); + headerPanel.add(this.getForPanel("app/outgoing_arrow.png")); + nickNamePanel.add(headerPanel, BorderLayout.CENTER); root.add(nickNamePanel, BorderLayout.CENTER); JPanel opPanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.MSG_HEADER); @@ -75,14 +76,14 @@ protected JPanel getHeader() { @Override public void subscribe() { super.subscribe(); - this.playerJoinSubscription = MercuryStoreCore.playerJoinSubject.subscribe(nickname -> { - if (this.data.getWhisperNickname().equals(nickname)) { - this.nicknameLabel.setForeground(AppThemeColor.TEXT_SUCCESS); - } - }); - this.playerLeaveSubscription = MercuryStoreCore.playerLeftSubject.subscribe(nickname -> { - if (this.data.getWhisperNickname().equals(nickname)) { - this.nicknameLabel.setForeground(AppThemeColor.TEXT_DISABLE); + this.autoCloseSubscription = MercuryStoreCore.plainMessageSubject.subscribe(message -> { + if (this.data.getWhisperNickname().equals(message.getNickName())) { + if (this.notificationConfig.get() + .getAutoCloseTriggers().stream() + .anyMatch(it -> StringUtils.normalizeSpace(it.toLowerCase()) + .equals(StringUtils.normalizeSpace(message.getMessage().toLowerCase())))) { + this.controller.performHide(); + } } }); } @@ -90,8 +91,7 @@ public void subscribe() { @Override public void onViewDestroy() { super.onViewDestroy(); - this.playerLeaveSubscription.unsubscribe(); - this.playerJoinSubscription.unsubscribe(); + this.autoCloseSubscription.unsubscribe(); } protected JButton getRepeatButton() { 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 7e55969c..f7c46934 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 @@ -18,6 +18,11 @@ public void visitHideout() { MercuryStoreCore.chatCommandSubject.onNext("/hideout " + notificationDescriptor.getNickName()); } + @Override + public void performInvite() { + MercuryStoreCore.chatCommandSubject.onNext("/invite " + notificationDescriptor.getNickName()); + } + @Override public void performLeave(String nickName) { MercuryStoreCore.chatCommandSubject.onNext("/kick " + nickName); 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 ae41039e..8ceeefec 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 @@ -3,5 +3,7 @@ public interface ScannerPanelController extends NotificationController { void visitHideout(); + void performInvite(); + void performLeave(String nickName); } 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 2f4fea81..c0b314df 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 @@ -31,6 +31,11 @@ public void visitHideout() { } + @Override + public void performInvite() { + + } + @Override public void performLeave(String nickName) { 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 b7aca667..c356d2e3 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 @@ -14,7 +14,9 @@ import java.awt.*; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; public class NotificationSettingsPagePanel extends SettingsPagePanel { private PlainConfigurationService notificationService; @@ -159,7 +161,7 @@ private JPanel getInNotificationHotKeysPanel() { JPanel root = this.componentsFactory.getJPanel(new GridLayout(0, 2, 4, 4), AppThemeColor.SETTINGS_BG); root.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_DEFAULT_BORDER)); this.incHotKeySnapshot.forEach(pair -> { - root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER)); + root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER, pair.getType().getTooltip())); HotKeyPanel hotKeyPanel = new HotKeyPanel(pair.getDescriptor()); this.incHotkeyGroup.registerHotkey(hotKeyPanel); root.add(this.componentsFactory.wrapToSlide(hotKeyPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1)); @@ -171,7 +173,7 @@ private JPanel getOutNotificationHotKeysPanel() { JPanel root = this.componentsFactory.getJPanel(new GridLayout(0, 2, 4, 4), AppThemeColor.SETTINGS_BG); root.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_DEFAULT_BORDER)); this.outHotKeySnapshot.forEach(pair -> { - root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER)); + root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER, pair.getType().getTooltip())); HotKeyPanel hotKeyPanel = new HotKeyPanel(pair.getDescriptor()); this.outHotkeyGroup.registerHotkey(hotKeyPanel); root.add(this.componentsFactory.wrapToSlide(hotKeyPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1)); @@ -183,7 +185,7 @@ private JPanel getScannerNotificationHotKeysPanel() { JPanel root = this.componentsFactory.getJPanel(new GridLayout(0, 2, 4, 4), AppThemeColor.SETTINGS_BG); root.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_DEFAULT_BORDER)); this.scannerHotKeySnapshot.forEach(pair -> { - root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER)); + root.add(this.componentsFactory.getIconLabel(pair.getType().getIconPath(), 18, SwingConstants.CENTER, pair.getType().getTooltip())); HotKeyPanel hotKeyPanel = new HotKeyPanel(pair.getDescriptor()); this.scannerHotkeyGroup.registerHotkey(hotKeyPanel); root.add(this.componentsFactory.wrapToSlide(hotKeyPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1)); @@ -206,6 +208,20 @@ private JPanel getOutgoingPanel() { this.generalSnapshot.setDismissAfterLeave(closeAfterLeave.isSelected()); }); propertiesPanel.add(closeAfterLeave); + propertiesPanel.add(this.componentsFactory.getTextLabel("Auto-close triggers:", FontStyle.REGULAR, 16)); + String collect = this.generalSnapshot.getAutoCloseTriggers() + .stream() + .collect(Collectors.joining(",")); + JTextField triggersField = this.componentsFactory.getTextField(collect, FontStyle.DEFAULT, 15f); + triggersField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + generalSnapshot.setAutoCloseTriggers(Arrays.stream(triggersField.getText().split(",")) + .filter(it -> !it.isEmpty()) + .collect(Collectors.toList())); + } + }); + propertiesPanel.add(triggersField); ResponseButtonsPanel responseButtonsPanel = new ResponseButtonsPanel(this.generalSnapshot.getOutButtons(), this.outHotkeyGroup); responseButtonsPanel.onViewInit(); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/TaskBarSettingsPagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/TaskBarSettingsPagePanel.java index be773d67..b2a71308 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/TaskBarSettingsPagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/TaskBarSettingsPagePanel.java @@ -9,6 +9,8 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; public class TaskBarSettingsPagePanel extends SettingsPagePanel { @@ -25,6 +27,12 @@ public void onViewInit() { JTextField responseField = componentsFactory.getTextField(this.taskBarSnapshot.getDndResponseText(), FontStyle.REGULAR, 16f); responseField.setEnabled(this.taskBarSnapshot.isInGameDnd()); + responseField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + taskBarSnapshot.setDndResponseText(responseField.getText()); + } + }); JCheckBox inGameDND = this.componentsFactory.getCheckBox(this.taskBarSnapshot.isInGameDnd()); inGameDND.addActionListener(action -> { this.taskBarSnapshot.setInGameDnd(inGameDND.isSelected()); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java index 79f7c9a2..0b6689d7 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java @@ -342,7 +342,8 @@ private JPanel getExpandPanel() { this.changeBufferSize(this.notificationPanels .stream() .skip(this.config.get().getLimitCount()) - .mapToInt(it -> it.getParent().getPreferredSize().height).sum()); + .mapToInt(it -> it.getParent().getPreferredSize().height) + .sum()); } } else { expandButton.setIcon(this.componentsFactory.getIcon("app/expand-all.png", 22)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java index 32308807..7d1a913d 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java @@ -80,11 +80,11 @@ private JPanel getBottomPanel() { AdrDurationComponentDescriptor donateDescriptor = new AdrProgressBarDescriptor(); donateDescriptor.setIconEnable(false); - donateDescriptor.setDuration(10d); + donateDescriptor.setDuration(200d); donateDescriptor.setSize(new Dimension(100, 20)); donateDescriptor.setType(AdrComponentType.PROGRESS_BAR); donateDescriptor.setCustomTextEnable(true); - donateDescriptor.setCustomText("5$"); + donateDescriptor.setCustomText("77$"); donateDescriptor.setFontSize(21); donateDescriptor.setLowValueTextColor(AppThemeColor.TEXT_DEFAULT); donateDescriptor.setMediumValueTextColor(AppThemeColor.TEXT_DEFAULT); @@ -93,7 +93,7 @@ private JPanel getBottomPanel() { donateDescriptor.setBackgroundColor(AppThemeColor.FRAME); donateDescriptor.setForegroundColor(AppThemeColor.BUTTON); MercuryTracker tracker = new MercuryTracker(donateDescriptor); - float percent = 150 * (5 / 100f); + float percent = 200 * (77 / 100f); tracker.setValue((int) (percent * 100)); tracker.setPreferredSize(donateDescriptor.getSize()); root.add(this.componentsFactory.getTextLabel("Monthly donations:", FontStyle.BOLD, 16), BorderLayout.LINE_START); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestEngine.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestEngine.java index 135b8680..848d0d57 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestEngine.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestEngine.java @@ -102,6 +102,16 @@ public TestEngine() { currency.add("wisdom"); currency.add("xoph's breachstone"); currency.add("yriel's"); + currency.add("Mirror Shard"); + currency.add("Exalted Shard"); + currency.add("Annulment Shard"); + currency.add("Ancient Orb"); + currency.add("Engineer's Orb"); + currency.add("Harbinger's Orb"); + currency.add("Orb of Horizons"); + currency.add("Orb of Binding"); + currency.add("Orb of Annulment"); + currency.add("Divine Vessel"); nickNames.add(" Example1"); nickNames.add("Example2"); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/manager/HideSettingsManager.java b/app-ui/src/main/java/com/mercury/platform/ui/manager/HideSettingsManager.java index 2a773a5e..9cdb6d0f 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/manager/HideSettingsManager.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/manager/HideSettingsManager.java @@ -1,8 +1,5 @@ package com.mercury.platform.ui.manager; -import com.mercury.platform.shared.config.Configuration; -import com.mercury.platform.shared.config.descriptor.ApplicationDescriptor; -import com.mercury.platform.shared.store.MercuryStoreCore; import com.mercury.platform.ui.frame.AbstractComponentFrame; import java.util.ArrayList; @@ -17,12 +14,6 @@ public void registerFrame(AbstractComponentFrame frame) { } public void apply(int fadeTime, int minOpacity, int maxOpacity) { - ApplicationDescriptor config = Configuration.get().applicationConfiguration().get(); - config.setMaxOpacity(maxOpacity); - config.setMinOpacity(minOpacity); - config.setFadeTime(fadeTime); - MercuryStoreCore.saveConfigSubject.onNext(true); - this.frames.forEach(frame -> { if (fadeTime > 0) { frame.enableHideEffect(fadeTime, minOpacity, maxOpacity);