Skip to content

Commit

Permalink
Refactor BisqApp - move icon load into ImageUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
lusarz committed Oct 9, 2019
1 parent 7bed73e commit 23877d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
13 changes: 1 addition & 12 deletions desktop/src/main/java/bisq/desktop/app/BisqApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,7 @@ private void setupStage(Scene scene) {
stage.setScene(scene);
stage.setMinWidth(MIN_WINDOW_WIDTH);
stage.setMinHeight(MIN_WINDOW_HEIGHT);

// on Windows the title icon is also used as task bar icon in a larger size
// on Linux no title icon is supported but also a large task bar icon is derived from that title icon
String iconPath;
if (Utilities.isOSX())
iconPath = ImageUtil.isRetina() ? "/images/[email protected]" : "/images/window_icon.png";
else if (Utilities.isWindows())
iconPath = "/images/task_bar_icon_windows.png";
else
iconPath = "/images/task_bar_icon_linux.png";

stage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath)));
stage.getIcons().add(ImageUtil.getApplicationIconImage());

// make the UI visible
stage.show();
Expand Down
14 changes: 14 additions & 0 deletions desktop/src/main/java/bisq/desktop/util/ImageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import bisq.core.locale.Country;

import bisq.common.util.Utilities;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

Expand All @@ -40,6 +42,18 @@ public static ImageView getImageViewById(String id) {
return imageView;
}

public static Image getApplicationIconImage () {
String iconPath;
if (Utilities.isOSX())
iconPath = ImageUtil.isRetina() ? "/images/[email protected]" : "/images/window_icon.png";
else if (Utilities.isWindows())
iconPath = "/images/task_bar_icon_windows.png";
else
iconPath = "/images/task_bar_icon_linux.png";

return getImageByUrl(iconPath);
}

private static Image getImageByUrl(String url) {
return new Image(ImageUtil.class.getResourceAsStream(url));
}
Expand Down

0 comments on commit 23877d4

Please sign in to comment.