Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions desktop/src/main/java/haveno/desktop/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@
-fx-image: url("../../images/settings.png");
}

#image-fiat-logo {
-fx-image: url("../../images/fiat_logo_light_mode.png");
}

#image-btc-logo {
-fx-image: url("../../images/btc_logo.png");
}
Expand Down
4 changes: 4 additions & 0 deletions desktop/src/main/java/haveno/desktop/theme-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -643,3 +643,7 @@
.regular-text-color {
-fx-text-fill: -bs-text-color;
}

#image-fiat-logo {
-fx-image: url("../../images/fiat_logo_dark_mode.png");
}
63 changes: 38 additions & 25 deletions desktop/src/main/java/haveno/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ protected void updateItem(CurrencyListItem item, boolean empty) {
break;
default:

// use icons for crypto
if (CurrencyUtil.isCryptoCurrency(code)) {
// use icon if available
StackPane currencyIcon = getCurrencyIcon(code);
if (currencyIcon != null) {
label1.setText("");
StackPane iconWrapper = new StackPane(getCurrencyIcon(code)); // TODO: icon must be wrapped in StackPane for reliable rendering on linux
label1.setGraphic(iconWrapper);
label1.setGraphic(currencyIcon);
}

if (preferences.isSortMarketCurrenciesNumerically() && item.numTrades > 0) {
Expand Down Expand Up @@ -459,10 +459,11 @@ protected void updateItem(TradeCurrency item, boolean empty) {
break;
default:

// use icons for crypto
if (CurrencyUtil.isCryptoCurrency(item.getCode())) {
// use icon if available
StackPane currencyIcon = getCurrencyIcon(code);
if (currencyIcon != null) {
label1.setText("");
label1.setGraphic(getCurrencyIcon(item.getCode()));
label1.setGraphic(currencyIcon);
}

boolean isCrypto = CurrencyUtil.isCryptoCurrency(code);
Expand Down Expand Up @@ -502,10 +503,11 @@ protected void updateItem(TradeCurrency item, boolean empty) {
Label label2 = new AutoTooltipLabel(item.getNameAndCode());
label2.getStyleClass().add("currency-label");

// use icons for crypto
if (CurrencyUtil.isCryptoCurrency(item.getCode())) {
// use icon if available
StackPane currencyIcon = getCurrencyIcon(item.getCode());
if (currencyIcon != null) {
label1.setText("");
label1.setGraphic(getCurrencyIcon(item.getCode()));
label1.setGraphic(currencyIcon);
}

box.getChildren().addAll(label1, label2);
Expand Down Expand Up @@ -1278,19 +1280,31 @@ private static <T> void updateEdgeColumnStyleClasses(TableView<T> tableView) {
return contentColumns;
}

public static ImageView getCurrencyIcon(String currencyCode) {
return getCurrencyIcon(currencyCode, 24);
private static ImageView getCurrencyImageView(String currencyCode) {
return getCurrencyImageView(currencyCode, 24);
}

public static ImageView getCurrencyIcon(String currencyCode, double size) {
private static ImageView getCurrencyImageView(String currencyCode, double size) {
if (currencyCode == null) return null;
ImageView iconView = new ImageView();
iconView.setFitWidth(size);
iconView.setPreserveRatio(true);
iconView.setSmooth(true);
iconView.setCache(true);
iconView.setId(getImageId(currencyCode));
return iconView;
String imageId = getImageId(currencyCode);
if (imageId == null) return null;
ImageView icon = new ImageView();
icon.setFitWidth(size);
icon.setPreserveRatio(true);
icon.setSmooth(true);
icon.setCache(true);
icon.setId(imageId);
return icon;
}

public static StackPane getCurrencyIcon(String currencyCode) {
ImageView icon = getCurrencyImageView(currencyCode);
return icon == null ? null : new StackPane(icon);
}

public static StackPane getCurrencyIcon(String currencyCode, double size) {
ImageView icon = getCurrencyImageView(currencyCode, size);
return icon == null ? null : new StackPane(icon);
}

public static StackPane getCurrencyIconWithBorder(String currencyCode) {
Expand All @@ -1300,12 +1314,9 @@ public static StackPane getCurrencyIconWithBorder(String currencyCode) {
public static StackPane getCurrencyIconWithBorder(String currencyCode, double size, double borderWidth) {
if (currencyCode == null) return null;

ImageView icon = getCurrencyIcon(currencyCode, size);
ImageView icon = getCurrencyImageView(currencyCode, size);
icon.setFitWidth(size - 2 * borderWidth);
icon.setFitHeight(size - 2 * borderWidth);
icon.setPreserveRatio(true);
icon.setSmooth(true);
icon.setCache(true);

StackPane circleWrapper = new StackPane(icon);
circleWrapper.setPrefSize(size, size);
Expand All @@ -1327,7 +1338,9 @@ public static StackPane getCurrencyIconWithBorder(String currencyCode, double si

private static String getImageId(String currencyCode) {
if (currencyCode == null) return null;
return "image-" + currencyCode.toLowerCase() + "-logo";
if (CurrencyUtil.isCryptoCurrency(currencyCode)) return "image-" + currencyCode.toLowerCase() + "-logo";
if (CurrencyUtil.isFiatCurrency(currencyCode)) return "image-fiat-logo";
return null;
}

public static void adjustHeightAutomatically(TextArea textArea) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading