Skip to content

Commit

Permalink
Release 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Morph21 committed Feb 11, 2022
1 parent 897ab9a commit a8ac7d6
Show file tree
Hide file tree
Showing 17 changed files with 336 additions and 90 deletions.
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.2.2";
public static final String APP_VERSION = "1.2.3";
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 @@ -37,6 +37,11 @@ public void load() {
}
} catch (Exception e) {
logger.error("Error during loading history file: ", e);
try {
configFile.delete();
} catch (Exception ex) {
logger.error("Cannot delete file: " + configFile.getPath() + " please remove it manually and restart MercuryTrade", ex);
}
}
} else {
createEmptyFile();
Expand Down Expand Up @@ -70,6 +75,14 @@ public void add(NotificationDescriptor notificationDescriptor) {

} catch (Exception e) {
logger.error("Error during adding message to history file: ", e);
File configFile = new File(HISTORY_FILE);
try {
if (configFile.exists()) {
configFile.delete();
}
} catch (Exception ex) {
logger.error("Cannot delete file: " + configFile.getPath() + " please remove it manually and restart MercuryTrade", ex);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.mercury.platform.shared.entity.message.PlainMessageDescriptor;
import rx.subjects.PublishSubject;

import java.awt.*;


public class MercuryStoreCore {
public static final PublishSubject<SoundType> soundSubject = PublishSubject.create();
Expand Down Expand Up @@ -66,4 +68,5 @@ public class MercuryStoreCore {
public static final PublishSubject<NotificationDescriptor> expiredNotificationSubject = PublishSubject.create();

public static final PublishSubject<VulkanDescriptor> vulkanSupportSubject = PublishSubject.create();
public static final PublishSubject<Component> checkForUpdatesSubject = PublishSubject.create();
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void paintComponent(Graphics g) {
this.paintAlphaValue = 1.0f;
}
}
this.repaint();
//this.repaint();
}

protected JPanel getTimePanel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onViewInit() {
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
FramesManager.INSTANCE.hideFrame(SettingsFrame.class);
FramesManager.INSTANCE.preShowFrame(NotesFrame.class);
FramesManager.INSTANCE.showFrame(NotesFrame.class);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


public class AlertDialog extends BaseDialog<Boolean, String> {
private boolean onlyOk = false;

public AlertDialog(DialogCallback<Boolean> callback, String text, Component relative) {
super(callback, relative, text);
}
Expand All @@ -26,23 +28,35 @@ protected void createView() {
JPanel miscPanel = this.componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER));
miscPanel.setBackground(AppThemeColor.SLIDE_BG);
miscPanel.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 50));
JButton okButton = this.componentsFactory.getBorderedButton("Yes", 16);
okButton.setPreferredSize(new Dimension(120, 26));
okButton.addActionListener(action -> {
this.callback.onAction(true);
this.setVisible(false);
this.dispose();
});
JButton cancelButton = this.componentsFactory.getBorderedButton("No", 16);
cancelButton.addActionListener(action -> {
this.callback.onAction(false);
this.setVisible(false);
this.dispose();
});
cancelButton.setPreferredSize(new Dimension(120, 26));

miscPanel.add(okButton);
miscPanel.add(cancelButton);

if (!onlyOk) {
JButton okButton = this.componentsFactory.getBorderedButton("Yes", 16);
okButton.setPreferredSize(new Dimension(120, 26));
okButton.addActionListener(action -> {
this.callback.onAction(true);
this.setVisible(false);
this.dispose();
});
JButton cancelButton = this.componentsFactory.getBorderedButton("No", 16);
cancelButton.addActionListener(action -> {
this.callback.onAction(false);
this.setVisible(false);
this.dispose();
});
cancelButton.setPreferredSize(new Dimension(120, 26));

miscPanel.add(okButton);
miscPanel.add(cancelButton);
} else {
JButton okButton = this.componentsFactory.getBorderedButton("OK", 16);
okButton.setPreferredSize(new Dimension(120, 26));
okButton.addActionListener(action -> {
this.setVisible(false);
this.dispose();
});
miscPanel.add(okButton);
}

root.add(miscPanel, BorderLayout.PAGE_END);

this.setResizable(false);
Expand Down
48 changes: 48 additions & 0 deletions app-ui/src/main/java/com/mercury/platform/ui/dialog/OkDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.mercury.platform.ui.dialog;

import com.mercury.platform.ui.components.fields.font.FontStyle;
import com.mercury.platform.ui.components.fields.font.TextAlignment;
import com.mercury.platform.ui.misc.AppThemeColor;

import javax.swing.*;
import java.awt.*;

public class OkDialog extends BaseDialog<Boolean, String> {

public OkDialog(DialogCallback<Boolean> callback, String text, Component relative) {
super(callback, relative, text);
}

protected void createView() {
this.setLayout(new BorderLayout());
this.getRootPane().setBackground(AppThemeColor.FRAME_RGB);
JPanel root = this.componentsFactory.getJPanel(new BorderLayout());
root.setBackground(AppThemeColor.SLIDE_BG);
root.setBorder(BorderFactory.createLineBorder(AppThemeColor.MSG_HEADER_BORDER));
JLabel header = this.componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_NICKNAME, TextAlignment.CENTER, 18f, this.payload);
header.setBackground(AppThemeColor.FRAME_RGB);
root.add(header, BorderLayout.CENTER);

JPanel miscPanel = this.componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER));
miscPanel.setBackground(AppThemeColor.SLIDE_BG);
miscPanel.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 50));


JButton okButton = this.componentsFactory.getBorderedButton("OK", 16);
okButton.setPreferredSize(new Dimension(120, 26));
okButton.addActionListener(action -> {
if (this.callback != null) {
this.callback.onAction(true);
}
this.setVisible(false);
this.dispose();
});
miscPanel.add(okButton);


root.add(miscPanel, BorderLayout.PAGE_END);

this.setResizable(false);
this.add(root, BorderLayout.CENTER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import java.util.List;
import java.util.Map;

import static java.awt.event.ItemEvent.DESELECTED;
import static java.awt.event.ItemEvent.SELECTED;

public class ItemsGridFrame extends AbstractMovableComponentFrame {
private ItemsGridPanel itemsGridPanel;
private HorizontalScrollContainer tabsContainer;
Expand Down Expand Up @@ -97,39 +100,63 @@ protected JPanel getPanelForPINSettings() {
JPanel topPanel = componentsFactory.getTransparentPanel(new BorderLayout());
topPanel.setBackground(AppThemeColor.FRAME);
JPanel headerPanel = componentsFactory.getTransparentPanel(new BorderLayout());
JPanel defaultGridPanel = componentsFactory.getTransparentPanel(new GridLayout(12, 12));
defaultGridPanel.setBorder(null);
for (int x = 0; x < 12; x++) {
for (int y = 0; y < 12; y++) {
defaultGridPanel.add(getCellPlaceholder());
}
}
defaultGridPanel.setBackground(AppThemeColor.FRAME_ALPHA);

JPanel quadGridPanel = componentsFactory.getTransparentPanel(new GridLayout(24, 24));
quadGridPanel.setBorder(null);
for (int x = 0; x < 24; x++) {
for (int y = 0; y < 24; y++) {
quadGridPanel.add(getCellPlaceholder());
}
}
quadGridPanel.setBackground(AppThemeColor.FRAME_ALPHA);
JPanel defaultGridPanel = createGridPanel(12,12);
JPanel quadGridPanel = createGridPanel(24,24);

// JPanel folderDefaultGridPanel = createGridPanel(12,12);
// JPanel folderQuadGridPanel = createGridPanel(24,24);
//
// JPanel separator = componentsFactory.getSeparator();

JPanel labelPanel = componentsFactory.getTransparentPanel(new BorderLayout());
JComboBox tabType = componentsFactory.getComboBox(new String[]{"1x1", "4x4"});
JComboBox tabType = componentsFactory.getComboBox(new String[]{"1x1", "4x4"});//, "Folder 1x1", "Folder 4x4"});
tabType.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
String item = (String) e.getItem();

if (item.equals("4x4")) {
panel.remove(defaultGridPanel);
panel.add(quadGridPanel, BorderLayout.CENTER);
} else {
panel.remove(quadGridPanel);
panel.add(defaultGridPanel, BorderLayout.CENTER);
}
this.pack();
this.repaint();
this.revalidate();
String item;
switch (e.getStateChange()) {
case DESELECTED:
item = (String) e.getItem();

switch (item) {
case "1x1":
panel.remove(defaultGridPanel);
break;
case "4x4":
panel.remove(quadGridPanel);
break;
// case "Folder 1x1":
// topPanel.remove(separator);
// panel.remove(folderDefaultGridPanel);
// break;
// case "Folder 4x4":
// topPanel.remove(separator);
// panel.remove(folderQuadGridPanel);
// break;
}
break;
case SELECTED:
item = (String) e.getItem();

switch (item) {
case "1x1":
panel.add(defaultGridPanel, BorderLayout.CENTER);
break;
case "4x4":
panel.add(quadGridPanel, BorderLayout.CENTER);
break;
// case "Folder 1x1":
// topPanel.add(separator, BorderLayout.PAGE_END);
// panel.add(folderDefaultGridPanel, BorderLayout.CENTER);
// break;
// case "Folder 4x4":
// topPanel.add(separator, BorderLayout.PAGE_END);
// panel.add(folderQuadGridPanel, BorderLayout.CENTER);
// break;
}
this.pack();
this.repaint();
this.revalidate();
break;
}
});
tabType.setPreferredSize(new Dimension((int) (componentsFactory.getScale() * 70), tabType.getHeight()));
Expand All @@ -144,18 +171,18 @@ protected JPanel getPanelForPINSettings() {
JButton disableButton = componentsFactory.getBorderedButton(title);
disableButton.setPreferredSize(new Dimension((int) (90 * componentsFactory.getScale()), (int) (24 * componentsFactory.getScale())));
componentsFactory.setUpToggleCallbacks(disableButton,
() -> {
disableButton.setText("Enable");
titleLabel.setForeground(AppThemeColor.TEXT_DISABLE);
applicationConfig.get().setItemsGridEnable(false);
repaint();
},
() -> {
disableButton.setText("Disable");
titleLabel.setForeground(AppThemeColor.TEXT_NICKNAME);
applicationConfig.get().setItemsGridEnable(true);
repaint();
}, this.applicationConfig.get().isItemsGridEnable());
() -> {
disableButton.setText("Enable");
titleLabel.setForeground(AppThemeColor.TEXT_DISABLE);
applicationConfig.get().setItemsGridEnable(false);
repaint();
},
() -> {
disableButton.setText("Disable");
titleLabel.setForeground(AppThemeColor.TEXT_NICKNAME);
applicationConfig.get().setItemsGridEnable(true);
repaint();
}, this.applicationConfig.get().isItemsGridEnable());
JButton hideButton = componentsFactory.getBorderedButton("Save");
hideButton.setPreferredSize(new Dimension((int) (90 * componentsFactory.getScale()), (int) (24 * componentsFactory.getScale())));
hideButton.addMouseListener(new MouseAdapter() {
Expand Down Expand Up @@ -230,6 +257,18 @@ public void mouseWheelMoved(MouseWheelEvent e) {
return panel;
}

private JPanel createGridPanel(int rows, int cols) {
JPanel gridPanel = componentsFactory.getTransparentPanel(new GridLayout(rows, cols));
gridPanel.setBorder(null);
for (int x = 0; x < rows; x++) {
for (int y = 0; y < cols; y++) {
gridPanel.add(getCellPlaceholder());
}
}
gridPanel.setBackground(AppThemeColor.FRAME_ALPHA);
return gridPanel;
}

private JPanel getCellPlaceholder() {
JPanel cell = new JPanel();
cell.setOpaque(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ public void subscribe() {
}
if (this.preProcessor.isAllowed(notification)) {
MercuryStoreCore.soundSubject.onNext(SoundType.MESSAGE);
PushBulletManager.INSTANCE.sendPush(notification.getSourceString(), notification.getWhisperNickname());
if (NotificationType.INC_ITEM_MESSAGE.equals(notification.getType()) || NotificationType.INC_CURRENCY_MESSAGE.equals(notification.getType())) {
PushBulletManager.INSTANCE.sendPush(notification.getSourceString(), notification.getWhisperNickname());
}
this.addNotification(notificationPanel);
}
});
Expand All @@ -129,7 +131,7 @@ public void subscribe() {
.setData(message)
.setComponentsFactory(this.componentsFactory)
.build();
PushBulletManager.INSTANCE.sendPush(message.getMessage().replaceAll("\\<[^>]*>",""), message.getNickName());
PushBulletManager.INSTANCE.sendPush(message.getMessage().replaceAll("\\<[^>]*>", ""), message.getNickName());
this.addNotification(notificationPanel);
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mercury.platform.ui.frame.titled;

public class GithubReleaseResponse {
private String tag_name;

public String getTag_name() {
return tag_name;
}

public void setTag_name(String tag_name) {
this.tag_name = tag_name;
}
}

Loading

0 comments on commit a8ac7d6

Please sign in to comment.