Skip to content

Commit

Permalink
Release 1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Morph21 committed Dec 20, 2024
1 parent 586109a commit b0e9b1d
Show file tree
Hide file tree
Showing 25 changed files with 224 additions and 63 deletions.
11 changes: 10 additions & 1 deletion app-core/src/main/java/com/mercury/platform/core/ChatHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.sun.jna.platform.win32.WinUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.swing.*;
import java.awt.*;
Expand All @@ -29,6 +31,7 @@
public class ChatHelper implements AsSubscriber {
private Robot robot;
private static boolean clipboardMessageOn = true;
private final static Logger logger = LogManager.getLogger(ChatHelper.class);

public ChatHelper() {
subscribe();
Expand Down Expand Up @@ -177,7 +180,13 @@ private void findInStashTab(String toBeFound) {
this.gameToFront();
StringSelection selection = new StringSelection(toBeFound);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
System.out.println(toBeFound);
clipboard.setContents(selection, null);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
logger.error("Unexpected expection while waiting till clipboard contents will set", e);
}
MercuryStoreCore.blockHotkeySubject.onNext(true);

robot.keyRelease(KeyEvent.VK_ALT);
Expand Down Expand Up @@ -269,6 +278,6 @@ private String removeCharactersThatBreakTheSearch(String textToSearch) {
if (StringUtils.isBlank(textToSearch)) {
return StringUtils.EMPTY;
}
return textToSearch.replace(",", StringUtils.EMPTY);
return textToSearch.replaceAll(",", StringUtils.EMPTY);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mercury.platform.core;

public class MercuryConstants {
public static final String APP_VERSION = "1.3.8";
public static final String APP_VERSION = "1.3.9";
public static final String SERVER_HOST = "exslims.ddns.net";
public static final int PORT = 5555;
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void run() {
}
APP_STATUS = FrameVisibleState.SHOW;
MercuryStoreCore.frameVisibleSubject.onNext(FrameVisibleState.SHOW);
MercuryStoreCore.showMessageHideButton.onNext(true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ public class IconConst {
public final static String APP_ICON = PREFIX + "app-icon.png";
public final static String PUSHBULLET_NOTIFICATION = PREFIX + "notification.png";
public final static String PUSHBULLET_NOTIFICATION_OFF = PREFIX + "notification_off.png";
public final static String MESSAGE_NOTIFICATION_OFF = PREFIX + "notifications-disable.png";
public final static String MESSAGE_NOTIFICATION_ON = PREFIX + "notifications-enable.png";



}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ public class MercuryStoreCore {

public static final PublishSubject<VulkanDescriptor> vulkanSupportSubject = PublishSubject.create();
public static final PublishSubject<Component> checkForUpdatesSubject = PublishSubject.create();
public static final PublishSubject<Boolean> showMessageHideButton = PublishSubject.create();
}
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ public enum TranslationKey {
russian("russian"),
choose_language("Choose language"),
language_change_requires_application_restart("Language change requires application restart."),
hide_notifications("Hide notifications until next incoming or manually shown"),
show_notifications("Show notifications")
;

private String defaultValue;
Expand Down
2 changes: 2 additions & 0 deletions app-shared/src/main/resources/lang/en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,5 @@ russian = russian
polish = polish
choose_language = Choose language
language_change_requires_application_restart = Language change requires application restart.
hide_notifications = Hide notifications until next incoming or manually shown
show_notifications = Show notifications
8 changes: 6 additions & 2 deletions app-shared/src/main/resources/lang/pl.lang
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ create = stwórz
// Is it Quad?
is_it_quad = Czy to jest Quad?
// Find in stashtab
find_in_stashtab = Znajdź w zakładce
find_in_stashtab = Znajdź w skrytce
// App version
app_version = Wersja aplikacji
// Taskbar will be hidden until you hover onto it
Expand Down Expand Up @@ -467,4 +467,8 @@ polish = polski
// Choose language
choose_language = Wybierz język
// Language change requires application restart.
language_change_requires_application_restart = Zmiana języka wymaga restartu aplikacji.
language_change_requires_application_restart = Zmiana języka wymaga restartu aplikacji.
// Hide notifications until next incoming or manually shown
hide_notifications = Ukryj powiadomienia do następnej wiadomości
// Show notifications
show_notifications = Pokaż powiadomienia
6 changes: 5 additions & 1 deletion app-shared/src/main/resources/lang/ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,8 @@ polish = польский
// Choose language
choose_language = Выберите язык
// Language change requires application restart.
language_change_requires_application_restart = Изменение языка требует перезагрузки приложения.
language_change_requires_application_restart = Изменение языка требует перезагрузки приложения.
// Hide notifications until next incoming or manually shown
hide_notifications = Скрыть уведомления до следующего сообщения
// Show notifications
show_notifications = Показать уведомления
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.mercury.platform.ui.components.panel.misc.ToggleCallback;
import com.mercury.platform.ui.misc.AppThemeColor;
import com.mercury.platform.ui.misc.MercuryStoreUI;
import com.mercury.platform.ui.misc.ToggleAdapter;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -132,6 +133,10 @@ private void loadFonts() {
}
}

public JButton getButton(FontStyle fontStyle, Color background, Border border, String text, float fontSize) {
return getButton(fontStyle, background, border, text, fontSize, null);
}

/**
* Get button with custom params
*
Expand All @@ -142,14 +147,19 @@ private void loadFonts() {
* @param fontSize font size
* @return JButton object
*/
public JButton getButton(FontStyle fontStyle, Color background, Border border, String text, float fontSize) {
public JButton getButton(FontStyle fontStyle, Color background, Border border, String text, float fontSize, String tooltip) {
JButton button = new JButton(text) {
@Override
protected void paintBorder(Graphics g) {
if (!this.getModel().isPressed()) {
super.paintBorder(g);
}
}
@Override
public JToolTip createToolTip() {
JToolTip tip = ComponentsFactory.this.createTooltip(tooltip);
return tip;
}
};
button.setBackground(background);
button.setForeground(AppThemeColor.TEXT_DEFAULT);
Expand Down Expand Up @@ -193,13 +203,23 @@ public void mouseExited(MouseEvent e) {
* @param text text on button
* @return Default app button
*/
public JButton getButton(String text) {
public JButton getButton(String text, String tooltip) {
CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT, 1),
BorderFactory.createLineBorder(AppThemeColor.BUTTON, 3)
);

return getButton(FontStyle.BOLD, AppThemeColor.BUTTON, compoundBorder, text, scale * 14f);
return getButton(FontStyle.BOLD, AppThemeColor.BUTTON, compoundBorder, text, scale * 14f, tooltip);
}

/**
* Get button with default properties
*
* @param text text on button
* @return Default app button
*/
public JButton getButton(String text) {
return getButton(text, null);
}

/**
Expand Down Expand Up @@ -240,23 +260,18 @@ public Component setUpToggleCallbacks(Component button,
ToggleCallback firstState,
ToggleCallback secondState,
boolean initialState) {
button.addMouseListener(new MouseAdapter() {
private boolean state = initialState;

@Override
public void mouseClicked(MouseEvent e) {
if (state) {
firstState.onToggle();
state = false;
} else {
secondState.onToggle();
state = true;
}
}
});
button.addMouseListener(createListenerForToggleCallbacks(button, firstState, secondState, initialState));
return button;
}

public ToggleAdapter createListenerForToggleCallbacks(Component button,
ToggleCallback firstState,
ToggleCallback secondState,
boolean initialState) {
ToggleAdapter listener = new ToggleAdapter(firstState, secondState, initialState);
return listener;
}

public JButton getIconButton(String iconPath, float iconSize, Color background, String tooltip) {
int i = iconPath.lastIndexOf("/");
String temp = iconPath.substring(i + 1);
Expand Down Expand Up @@ -365,7 +380,7 @@ public JToolTip createTooltip(String text) {
return toolTip;
}

private String wrapTextWithPadding(String text) {
public String wrapTextWithPadding(String text) {
StringBuilder b = new StringBuilder();
b.append("<html>");
b.append("<div style=\"padding: 2px 4px 2px 4px;\">");
Expand Down Expand Up @@ -999,7 +1014,7 @@ public String getTooltipMessageForChatHistory(NotificationDescriptor source) {
b.append("<p>");
b.append(d.isIncoming() ? "> " : "");
b.append(d.getMessage());
b.append("<br/>");
//b.append("<br/>");
b.append("</p>");
});
return b.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ private JPanel getFromPanel() {
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));

this.data.getItems().forEach((item) -> {
JButton itemBtn = this.componentsFactory.getButton(item);
JButton itemBtn = this.componentsFactory.getButton(item, TranslationKey.find_in_stashtab.value());
itemBtn.setBackground(AppThemeColor.FRAME);
itemBtn.setBorder(new EmptyBorder(4, 4, 4, 4));
itemBtn.addActionListener(action -> {
MercuryStoreCore.findInStashTab.onNext(item);
});
itemBtn.setToolTipText(TranslationKey.find_in_stashtab.value());
itemsPanel.add(itemBtn);
});
fromPanel.add(itemsPanel, BorderLayout.LINE_START);
Expand All @@ -73,12 +74,13 @@ private JPanel getFromPanel() {
JPanel itemsPanel = new JPanel();
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
JButton itemBtn = this.componentsFactory.getButton(this.data.getCurrForSaleCount().intValue() + " " + this.data.getCurrForSaleTitle());
JButton itemBtn = this.componentsFactory.getButton(this.data.getCurrForSaleCount().intValue() + " " + this.data.getCurrForSaleTitle(), TranslationKey.find_in_stashtab.value());
itemBtn.setBackground(AppThemeColor.FRAME);
itemBtn.setBorder(new EmptyBorder(4, 4, 4, 4));
itemBtn.addActionListener(action -> {
MercuryStoreCore.findInStashTab.onNext(this.data.getCurrForSaleTitle());
});
itemBtn.setToolTipText(TranslationKey.find_in_stashtab.value());
itemsPanel.add(itemBtn);
fromPanel.add(itemsPanel, BorderLayout.LINE_START);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ public JPanel getItemsPanel() {
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));

itemsWanted.forEach((item) -> {
JButton btn = this.componentsFactory.getButton(item);
JButton btn = this.componentsFactory.getButton(item, TranslationKey.find_in_stashtab.value());
btn.setForeground(AppThemeColor.TEXT_IMPORTANT);
btn.setBackground(AppThemeColor.FRAME);
btn.setBorder(new EmptyBorder(4,4,4,4));
btn.addActionListener(action -> {
this.controller.showITH();
MercuryStoreCore.findInStashTab.onNext(item);
});
btn.setToolTipText(TranslationKey.find_in_stashtab.value());
itemsPanel.add(btn);
});

Expand All @@ -71,14 +72,15 @@ public JPanel getItemsPanel() {
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));
JButton btn = this.componentsFactory.getButton(this.data.getItemName());
JButton btn = this.componentsFactory.getButton(this.data.getItemName(), TranslationKey.find_in_stashtab.value());
btn.setForeground(AppThemeColor.TEXT_IMPORTANT);
btn.setBackground(AppThemeColor.FRAME);
btn.setBorder(new EmptyBorder(4,4,4,4));
btn.addActionListener(action -> {
this.controller.showITH();
MercuryStoreCore.findInStashTab.onNext(this.data.getItemName());
});
btn.setToolTipText(TranslationKey.find_in_stashtab.value());
itemsPanel.add(btn);
}
return itemsPanel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mercury.platform.ui.components.panel.notification;

import com.mercury.platform.TranslationKey;
import com.mercury.platform.shared.config.descriptor.HotKeyType;
import com.mercury.platform.shared.entity.message.ItemTradeNotificationDescriptor;
import com.mercury.platform.shared.store.MercuryStoreCore;
Expand Down Expand Up @@ -53,10 +54,11 @@ public JPanel getItemsPanel() {
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));

itemsWanted.forEach((item) -> {
JButton btn = this.componentsFactory.getButton(item);
JButton btn = this.componentsFactory.getButton(item, TranslationKey.find_in_stashtab.value());
btn.addActionListener((action) -> {
MercuryStoreCore.findInStashTab.onNext(item);
});
btn.setToolTipText(TranslationKey.find_in_stashtab.value());
btn.setForeground(AppThemeColor.INC_PANEL_ARROW);
btn.setBackground(AppThemeColor.FRAME);
btn.setBorder(new EmptyBorder(4,4,4,4));
Expand All @@ -68,10 +70,11 @@ public JPanel getItemsPanel() {
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));
JButton btn = this.componentsFactory.getButton(this.data.getItemName());
JButton btn = this.componentsFactory.getButton(this.data.getItemName(), TranslationKey.find_in_stashtab.value());
btn.addActionListener((action) -> {
MercuryStoreCore.findInStashTab.onNext(this.data.getItemName());
});
btn.setToolTipText(TranslationKey.find_in_stashtab.value());
btn.setForeground(AppThemeColor.INC_PANEL_ARROW);
btn.setBackground(AppThemeColor.FRAME);
btn.setBorder(new EmptyBorder(4,4,4,4));
Expand Down
Loading

0 comments on commit b0e9b1d

Please sign in to comment.