Skip to content

Commit

Permalink
feat: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDead committed Jul 12, 2024
1 parent 066bdbd commit a44ef20
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ private void createTrayIcon() throws IOException {

if (trayIconListener != null) {
// Platform.runLater to run on the JavaFX thread
displayItem.addActionListener(e -> Platform.runLater(trayIconListener::onShowHide));
settingsItem.addActionListener(e -> Platform.runLater(trayIconListener::onSettings));
aboutItem.addActionListener(e -> Platform.runLater(trayIconListener::onAbout));
exitItem.addActionListener(e -> Platform.runLater(trayIconListener::onExit));
displayItem.addActionListener(_ -> Platform.runLater(trayIconListener::onShowHide));
settingsItem.addActionListener(_ -> Platform.runLater(trayIconListener::onSettings));
aboutItem.addActionListener(_ -> Platform.runLater(trayIconListener::onAbout));
exitItem.addActionListener(_ -> Platform.runLater(trayIconListener::onExit));

localTrayIcon.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
Expand Down Expand Up @@ -98,7 +98,7 @@ public void showTrayIcon() throws IOException {
logger.info("Displaying tray icon");
if (trayIcon == null) {
createTrayIcon();
if (!validTrayIcon()) {
if (invalidTrayIcon()) {
return;
}
}
Expand All @@ -119,7 +119,7 @@ public void showTrayIcon() throws IOException {
public void hideTrayIcon() {
logger.info("Hiding tray icon");

if (!validTrayIcon()) {
if (invalidTrayIcon()) {
return;
}

Expand All @@ -134,11 +134,11 @@ public void hideTrayIcon() {
*
* @return True if the tray icon is valid, false otherwise
*/
private boolean validTrayIcon() {
private boolean invalidTrayIcon() {
if (trayIcon == null) {
logger.warn("TrayIcon cannot be null!");
return false;
return true;
}
return true;
return false;
}
}

0 comments on commit a44ef20

Please sign in to comment.