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 e6522f55..93e1aa94 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.0.1.2"; + public static final String APP_VERSION = "1.0.1.3"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } diff --git a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java index 924618cd..36444741 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java @@ -77,6 +77,8 @@ private static class ConfigManagerHolder { private String dndResponseText = "Response text"; @Getter private String defaultWords = "!wtb, uber, boss, perandus"; + @Getter + private String quickResponse = "invite me pls"; public ConfigManager() { minimumFrameSize = new HashMap<>(); @@ -87,7 +89,7 @@ public ConfigManager() { minimumFrameSize.put("SettingsFrame",new Dimension(540,400)); minimumFrameSize.put("HistoryFrame",new Dimension(280,400)); minimumFrameSize.put("TimerFrame",new Dimension(240,102)); - minimumFrameSize.put("ChatFilterFrame",new Dimension(400,200)); + minimumFrameSize.put("ChatFilterFrame",new Dimension(400,100)); minimumFrameSize.put("ItemsGridFrame",new Dimension(150,150)); minimumFrameSize.put("NotesFrame",new Dimension(540,100)); minimumFrameSize.put("ChatFilterSettingsFrame",new Dimension(300,200)); @@ -113,6 +115,7 @@ public ConfigManager() { defaultAppSettings.put("showLeague",false); defaultAppSettings.put("dndResponseText","Response text"); defaultAppSettings.put("defaultWords","!wtb, uber, boss, perandus"); + defaultAppSettings.put("quickResponse","invite me pls"); } @@ -157,6 +160,7 @@ public void load() { saveProperty("inGameDnd", String.valueOf(defaultAppSettings.get("inGameDnd"))); saveProperty("dndResponseText", defaultAppSettings.get("dndResponseText")); saveProperty("defaultWords", defaultAppSettings.get("defaultWords")); + saveProperty("quickResponse", defaultAppSettings.get("quickResponse")); saveProperty("scaleData", defaultAppSettings.get("scaleData")); saveProperty("showLeague", String.valueOf(defaultAppSettings.get("showLeague"))); @@ -218,6 +222,7 @@ private void loadConfigFile(){ showLeague = Boolean.valueOf(loadProperty("showLeague")); dndResponseText = loadProperty("dndResponseText"); defaultWords = loadProperty("defaultWords"); + quickResponse = loadProperty("quickResponse"); } catch (Exception e) { logger.error("Error in loadConfigFile: ",e); } @@ -465,6 +470,10 @@ public void setDefaultWords(String defaultWords) { this.defaultWords = defaultWords; saveProperty("defaultWords",defaultWords); } + public void setQuickResponse(String quickResponse) { + this.quickResponse = quickResponse; + saveProperty("quickResponse",quickResponse); + } private List getDefaultButtons(){ List defaultButtons = new ArrayList<>(); diff --git a/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java b/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java index 4cc6f42c..c06d0100 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java @@ -6,9 +6,6 @@ import java.io.File; -/** - * Created by Константин on 21.02.2017. - */ public class UpdateManager { private final static Logger logger = LogManager.getLogger(UpdateManager.class.getSimpleName()); private final static String LOCAL_UPDATER_PATH = System.getenv("USERPROFILE") + "\\AppData\\Local\\MercuryTrade\\local-updater.jar"; @@ -19,6 +16,7 @@ public void doUpdate(){ logger.debug("Execute local updater, source path: {}",path); if(new File(JAR_FILE_PATH).exists()) { Runtime.getRuntime().exec("java -jar " + LOCAL_UPDATER_PATH + " " + "\"" + path + "\""); + System.exit(0); } } catch (Exception e1) { logger.error("Error while execute local-updater: ", e1); 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 9c8aee14..c10ea946 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 @@ -376,6 +376,7 @@ public JTextField getTextField(String text, FontStyle style, float fontSize){ textField.setFont(getSelectedFont(style).deriveFont(scale*fontSize)); } textField.setForeground(AppThemeColor.TEXT_DEFAULT); + textField.setCaretColor(AppThemeColor.TEXT_DEFAULT); textField.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(AppThemeColor.TEXT_DEFAULT,1), BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT,3) @@ -541,7 +542,7 @@ public ImageIcon getImage(String iconPath){ public Dimension convertSize(Dimension initialSize){ return new Dimension((int)(initialSize.width * scale),(int)(initialSize.height*scale)); } - public JTextArea getSimpleTextAre(String text){ + public JTextArea getSimpleTextArea(String text){ JTextArea area = new JTextArea(text); area.setEditable(false); area.setWrapStyleWord(true); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java index 870c2f3d..a180d948 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java @@ -1,6 +1,6 @@ package com.mercury.platform.ui.components.panel.chat; -import com.mercury.platform.shared.events.EventRouter; +import com.mercury.platform.shared.ConfigManager; import com.mercury.platform.shared.store.MercuryStore; import com.mercury.platform.ui.components.ComponentsFactory; import com.mercury.platform.ui.components.fields.font.FontStyle; @@ -45,12 +45,12 @@ public void createUI() { JPanel miscPanel = componentsFactory.getTransparentPanel(new BorderLayout()); JPanel operationsPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); - JButton invite = componentsFactory.getIconButton("app/invite.png", 16, AppThemeColor.SLIDE_BG, TooltipConstants.INVITE); - invite.addMouseListener(new MouseAdapter() { + JButton quickResponse = componentsFactory.getIconButton("app/chat_scanner_response.png", 17, AppThemeColor.SLIDE_BG, "Quick response"); + quickResponse.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if(SwingUtilities.isLeftMouseButton(e)) { - MercuryStore.INSTANCE.chatCommandSubject.onNext("/invite " + nickName); + MercuryStore.INSTANCE.chatCommandSubject.onNext("@" + nickName + " " + ConfigManager.INSTANCE.getQuickResponse()); } } }); @@ -73,9 +73,9 @@ public void mousePressed(MouseEvent e) { nickName); nicknameLabel.setPreferredSize(new Dimension(75,nicknameLabel.getPreferredSize().height)); nicknameLabel.setBorder(null); - invite.setBorder(null); + quickResponse.setBorder(null); openChat.setBorder(null); - operationsPanel.add(invite); + operationsPanel.add(quickResponse); operationsPanel.add(openChat); JPanel nicknamePanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java index defe315c..2ab32b73 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java @@ -17,11 +17,10 @@ public HtmlMessageBuilder() { * @param message source message * @return html equivalent */ - //RED - Navy public String build(String message) { List resultStrs = new ArrayList<>(); resultStrs.add(""); - String[] words = message.split("((?<= )|(?= )|(?<=\\.)|(?=\\.)|(?<=,)|(?<=\\?)|(?=\\?)|(?=,)|(?<=!)|(?=!)|(?<=/)|(?=/)|(?<=>)|(?=>))"); + String[] words = message.split("((?<=\\s)|(?=\\s)|(?<=\\.)|(?=\\.)|(?<=,)|(?<=\\?)|(?=\\?)|(?=,)|(?<=!)|(?=!)|(?<=/)|(?=/)|(?<=>)|(?=>))"); Arrays.stream(words).forEach(word -> { if(chunkStrings.stream().noneMatch(word::equalsIgnoreCase)){ resultStrs.add(word); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java index ae553a7f..005d5682 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java @@ -116,45 +116,45 @@ public void mouseReleased(MouseEvent e) { private JPanel getSoundPickerPanel(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); - JLabel soundLabel = componentsFactory.getTextLabel(FontStyle.REGULAR, AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP, 17f, "Sound"); + JLabel soundLabel = componentsFactory.getTextLabel(FontStyle.REGULAR, AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP, 17f, "Sound (in next update)"); soundLabel.setBorder( new CompoundBorder( BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), BorderFactory.createEmptyBorder(3,5,3,5))); - JPanel container = componentsFactory.getTransparentPanel(new GridLayout(2, 2,0,1)); - container.setBackground(AppThemeColor.SETTINGS_BG); - container.setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), - BorderFactory.createEmptyBorder(3,0,3,0))); - - JComboBox notificationComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); - notificationComboBox.addItemListener(e -> { - switch (e.getStateChange()){ - case ItemEvent.SELECTED: { - if(notificationComboBox.getSelectedItem().equals("Browse")){ - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileFilter(new FileNameExtensionFilter("*.wav","wav")); - int returnVal = fileChooser.showOpenDialog(null); - if(returnVal == JFileChooser.APPROVE_OPTION) { - System.out.println(fileChooser.getSelectedFile().getPath()); - } - } - break; - } - } - }); - - - JComboBox chatScannerComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); - - - container.add(componentsFactory.getTextLabel("Notification:",FontStyle.REGULAR)); - container.add(notificationComboBox); - container.add(componentsFactory.getTextLabel("Chat Scanner",FontStyle.REGULAR)); - container.add(chatScannerComboBox); +// JPanel container = componentsFactory.getTransparentPanel(new GridLayout(2, 2,0,1)); +// container.setBackground(AppThemeColor.SETTINGS_BG); +// container.setBorder(new CompoundBorder( +// BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), +// BorderFactory.createEmptyBorder(3,0,3,0))); +// +// JComboBox notificationComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); +// notificationComboBox.addItemListener(e -> { +// switch (e.getStateChange()){ +// case ItemEvent.SELECTED: { +// if(notificationComboBox.getSelectedItem().equals("Browse")){ +// JFileChooser fileChooser = new JFileChooser(); +// fileChooser.setFileFilter(new FileNameExtensionFilter("*.wav","wav")); +// int returnVal = fileChooser.showOpenDialog(null); +// if(returnVal == JFileChooser.APPROVE_OPTION) { +// System.out.println(fileChooser.getSelectedFile().getPath()); +// } +// } +// break; +// } +// } +// }); +// +// +// JComboBox chatScannerComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); +// +// +// container.add(componentsFactory.getTextLabel("Notification:",FontStyle.REGULAR)); +// container.add(notificationComboBox); +// container.add(componentsFactory.getTextLabel("Chat Scanner",FontStyle.REGULAR)); +// container.add(chatScannerComboBox); root.add(soundLabel,BorderLayout.PAGE_START); - root.add(container,BorderLayout.CENTER); +// root.add(container,BorderLayout.CENTER); return root; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java index 0125c34b..0131af77 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java @@ -58,7 +58,7 @@ public void mousePressed(MouseEvent e) { } } }); - JTextArea donateText = componentsFactory.getSimpleTextAre("We aimed to create a convenience tool in form of an easy-to-use application, primarily for trading purposes. If MercuryTrade successfully managed to save your time or improve your experience, you can thank us by donating and telling your friends."); + JTextArea donateText = componentsFactory.getSimpleTextArea("We aimed to create a convenience tool in form of an easy-to-use application, primarily for trading purposes. If MercuryTrade successfully managed to save your time or improve your experience, you can thank us by donating and telling your friends."); donateText.setPreferredSize(new Dimension(300,150)); JPanel donateTextPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); JPanel donateButtonPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java index 8ea0cde7..02de14ed 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java @@ -26,7 +26,7 @@ protected void initialize() { JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); root.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); root.setBackground(AppThemeColor.SLIDE_BG); - root.add(componentsFactory.getSimpleTextAre("Panels UNLOCKED Move them and click Lock when done."),BorderLayout.CENTER); + root.add(componentsFactory.getSimpleTextArea("Panels UNLOCKED Move them and click Lock when done."),BorderLayout.CENTER); JPanel miscPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); JButton restoreDefault = componentsFactory.getBorderedButton("Restore defaults"); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java index ce545a76..e246f4a9 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java @@ -39,7 +39,7 @@ public void initHandlers() { JLabel tooltipLabel = componentsFactory.getTextLabel(FontStyle.REGULAR,AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP,16f,tooltip); this.add(tooltipLabel,BorderLayout.CENTER); }else { - JTextArea tooltipArea = componentsFactory.getSimpleTextAre(""); + JTextArea tooltipArea = componentsFactory.getSimpleTextArea(""); this.add(tooltipArea,BorderLayout.CENTER); tooltipArea.setText(tooltip); if(tooltip.toCharArray().length < 120){ diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java index c5d2f662..6a54ee1d 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java @@ -8,16 +8,14 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -/** - * Created by Константин on 18.01.2017. - */ public abstract class AbstractTitledComponentFrame extends AbstractComponentFrame { protected JPanel miscPanel; protected JButton hideButton; + protected JPanel headerPanel; private JLabel frameTitleLabel; protected AbstractTitledComponentFrame(String title) { super(title); - miscPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + miscPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); } @Override @@ -28,7 +26,7 @@ protected void initialize() { private void initHeaderPanel(){ if(layout instanceof BorderLayout) { - JPanel headerPanel = new JPanel(new BorderLayout()); + headerPanel = new JPanel(new BorderLayout()); headerPanel.setBackground(AppThemeColor.HEADER); headerPanel.setPreferredSize(new Dimension(100,26)); headerPanel.setBorder(BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java index 9bb540f8..706bb1ce 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java @@ -214,7 +214,7 @@ private void renderCurrentNote(){ innerContent.setPreferredSize(new Dimension(530,270)); JLabel image = componentsFactory.getIconLabel(note.getImagePath()); - JTextArea textArea = componentsFactory.getSimpleTextAre(note.getText()); + JTextArea textArea = componentsFactory.getSimpleTextArea(note.getText()); switch (note.getLayout()){ case VERTICAL:{ innerContent.setLayout(new BoxLayout(innerContent,BoxLayout.Y_AXIS)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java index e1907159..2c90b014 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java @@ -2,9 +2,11 @@ import com.mercury.platform.core.utils.interceptor.MessageInterceptor; import com.mercury.platform.core.utils.interceptor.filter.MessageFilter; +import com.mercury.platform.shared.ConfigManager; import com.mercury.platform.shared.events.EventRouter; import com.mercury.platform.shared.entity.FrameSettings; import com.mercury.platform.shared.store.MercuryStore; +import com.mercury.platform.ui.components.fields.font.FontStyle; import com.mercury.platform.ui.components.panel.chat.ChatFilterPanel; import com.mercury.platform.ui.frame.titled.AbstractTitledComponentFrame; import com.mercury.platform.ui.misc.AppThemeColor; @@ -24,15 +26,21 @@ public class ChatFilterFrame extends AbstractTitledComponentFrame { private ChatFilterSettingsFrame settingsFrame; private ChatFilterPanel msgContainer; private MessageInterceptor interceptor; + private JPanel toolbar; private boolean soundEnable = false; private boolean scrollToBottom = true; + private boolean chatEnable = false; private JButton scrollEnd; public ChatFilterFrame() { super("MercuryTrade"); FrameSettings frameSettings = configManager.getFrameSettings(this.getClass().getSimpleName()); this.setPreferredSize(frameSettings.getFrameSize()); - this.settingsFrame = new ChatFilterSettingsFrame(this::performNewStrings); + this.settingsFrame = new ChatFilterSettingsFrame(strings -> { + if(chatEnable){ + performNewStrings(strings); + } + }); } @Override @@ -46,13 +54,73 @@ public void componentResized(ComponentEvent e) { } }); this.hideButton.setIcon(componentsFactory.getIcon("app/hide.png",14)); + this.hideButton.setBorder(BorderFactory.createEmptyBorder(0,2,0,2)); + this.headerPanel.add(getMenuButton(),BorderLayout.LINE_START); + this.miscPanel.add(getEnableButton(),0); +// this.miscPanel.add(getMinimizeButton(),1); + this.miscPanel.setBorder(BorderFactory.createEmptyBorder(-4,0,0,0)); this.settingsFrame.init(); this.msgContainer = new ChatFilterPanel(); + this.toolbar = getToolbar(); + toolbar.setVisible(false); + this.add(toolbar,BorderLayout.LINE_START); this.add(msgContainer,BorderLayout.CENTER); - this.add(getNavigationPanel(),BorderLayout.LINE_END); this.pack(); } + private JButton getEnableButton() { + JButton enableButton = componentsFactory.getBorderedButton("Start"); + enableButton.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(AppThemeColor.BORDER, 1), + BorderFactory.createMatteBorder(1,5,1,5,AppThemeColor.TRANSPARENT) + )); + enableButton.setFont(componentsFactory.getFont(FontStyle.BOLD,16f)); + enableButton.setPreferredSize(new Dimension(90,23)); + enableButton.setBackground(AppThemeColor.TRANSPARENT); + enableButton.setForeground(AppThemeColor.TEXT_SUCCESS); + + componentsFactory.setUpToggleCallbacks(enableButton, + () -> { + chatEnable = false; + if (interceptor != null) { + MercuryStore.INSTANCE.removeInterceptorSubject.onNext(interceptor); + } + enableButton.setText("Start"); + enableButton.setForeground(AppThemeColor.TEXT_SUCCESS); + repaint(); + }, + () -> { + chatEnable = true; + String chunkStr = StringUtils.deleteWhitespace(ConfigManager.INSTANCE.getDefaultWords()); + String[] split = chunkStr.split(","); + performNewStrings(split); + enableButton.setText("Stop"); + enableButton.setForeground(AppThemeColor.TEXT_IMPORTANT); + repaint(); + }, false); + return enableButton; + } + private JButton getMinimizeButton() { + JButton minimizer = componentsFactory.getIconButton("app/minimize.png", 14, AppThemeColor.FRAME_ALPHA, ""); + minimizer.addActionListener(action -> { + //todo + }); + return minimizer; + } + private JButton getMenuButton() { + JButton menu = componentsFactory.getIconButton("app/menu.png", 18, AppThemeColor.FRAME_ALPHA, "Menu"); + menu.setBorder(BorderFactory.createEmptyBorder(4,6,4,4)); + componentsFactory.setUpToggleCallbacks(menu, + () -> { + this.toolbar.setVisible(true); + repaint(); + }, + () -> { + this.toolbar.setVisible(false); + repaint(); + }, true); + return menu; + } private void performNewStrings(String[] strings){ List contains = new ArrayList<>(); List notContains = new ArrayList<>(); @@ -120,7 +188,7 @@ public void initHandlers() { }); } - private JPanel getNavigationPanel(){ + private JPanel getToolbar(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); root.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); @@ -136,7 +204,7 @@ private JPanel getNavigationPanel(){ "Chat Scanner settings"); edit.addActionListener( action -> this.settingsFrame.showAuxiliaryFrame( - new Point(this.getLocation().x+this.getSize().width/2,this.getLocation().y), + new Point(this.getLocation().x,this.getLocation().y), this.getPreferredSize().height)); JButton clear = componentsFactory.getIconButton( "app/clear-history.png", diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java index 0b110d33..39b99e84 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java @@ -12,6 +12,7 @@ public class ChatFilterSettingsFrame extends AbstractTitledComponentFrame { private ChatSettingsCallback callback; + private JTextField quickResponseField; public ChatFilterSettingsFrame(ChatSettingsCallback callback) { super("MercuryTrade"); @@ -37,7 +38,7 @@ protected void initialize() { 15f, "Show messages containing the following words:"); title.setBorder(BorderFactory.createEmptyBorder(2,0,6,0)); - JTextArea words = componentsFactory.getSimpleTextAre(ConfigManager.INSTANCE.getDefaultWords()); + JTextArea words = componentsFactory.getSimpleTextArea(ConfigManager.INSTANCE.getDefaultWords()); words.setEditable(true); words.setCaretColor(AppThemeColor.TEXT_DEFAULT); words.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); @@ -48,6 +49,8 @@ protected void initialize() { JButton save = componentsFactory.getBorderedButton("Save"); save.addActionListener(action -> { ConfigManager.INSTANCE.setDefaultWords(words.getText()); + ConfigManager.INSTANCE.setQuickResponse(quickResponseField.getText()); + String chunkStr = StringUtils.deleteWhitespace(words.getText()); String[] split = chunkStr.split(","); @@ -73,10 +76,35 @@ protected void initialize() { root.add(setupArea,BorderLayout.CENTER); root.add(getMemo(),BorderLayout.LINE_END); - root.add(navBar,BorderLayout.PAGE_END); + + JPanel padding = componentsFactory.getTransparentPanel(new BorderLayout()); + padding.setBorder(BorderFactory.createEmptyBorder(0,4,4,4)); + padding.add(getResponsePanel(),BorderLayout.CENTER); + root.add(padding,BorderLayout.PAGE_END); this.add(root,BorderLayout.CENTER); + this.add(navBar,BorderLayout.PAGE_END); this.pack(); } + private JPanel getResponsePanel(){ + JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); + JPanel setupArea = componentsFactory.getTransparentPanel(new BorderLayout()); + setupArea.setBorder(BorderFactory.createEmptyBorder(4,4,4,4)); + + root.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); + root.setBackground(AppThemeColor.SLIDE_BG); + + JButton quickResponse = componentsFactory.getIconButton("app/chat_scanner_response.png", 18f, AppThemeColor.SLIDE_BG, "Quick response"); + quickResponseField = componentsFactory.getTextField(ConfigManager.INSTANCE.getQuickResponse(),FontStyle.REGULAR,16f); + quickResponseField.setBackground(AppThemeColor.SLIDE_BG); + quickResponseField.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(AppThemeColor.HEADER,1), + BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT,3) + )); + setupArea.add(quickResponse,BorderLayout.LINE_START); + setupArea.add(quickResponseField,BorderLayout.CENTER); + root.add(setupArea,BorderLayout.CENTER); + return root; + } private JPanel getMemo(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); diff --git a/app-ui/src/main/resources/app/chat_scanner_response.png b/app-ui/src/main/resources/app/chat_scanner_response.png new file mode 100644 index 00000000..a9607e7c Binary files /dev/null and b/app-ui/src/main/resources/app/chat_scanner_response.png differ diff --git a/app-ui/src/main/resources/app/menu.png b/app-ui/src/main/resources/app/menu.png new file mode 100644 index 00000000..60cc9e1e Binary files /dev/null and b/app-ui/src/main/resources/app/menu.png differ diff --git a/app-ui/src/main/resources/app/minimize.png b/app-ui/src/main/resources/app/minimize.png new file mode 100644 index 00000000..a93d15a4 Binary files /dev/null and b/app-ui/src/main/resources/app/minimize.png differ diff --git a/app-ui/src/main/resources/app/openChat.png b/app-ui/src/main/resources/app/openChat.png index ba0bb89f..0c0d50c4 100644 Binary files a/app-ui/src/main/resources/app/openChat.png and b/app-ui/src/main/resources/app/openChat.png differ