add crypto icons to buy/sell pulldowns

This commit is contained in:
woodser 2025-05-02 14:37:18 -04:00
parent e3755300d8
commit ae0d3bb0e4
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF
10 changed files with 59 additions and 11 deletions

View file

@ -55,10 +55,6 @@
-fx-image: url("../../images/sell_red.png");
}
#image-xmr-logo {
-fx-image: url("../../images/xmr_logo.png");
}
#image-lock2x {
-fx-image: url("../../images/lock@2x.png");
}
@ -304,3 +300,42 @@
#image-new-trade-protocol-screenshot {
-fx-image: url("../../images/new_trade_protocol_screenshot.png");
}
/**
* Crypto logos.
*/
#image-btc-logo {
-fx-image: url("../../images/btc_logo.png");
}
#image-bch-logo {
-fx-image: url("../../images/bch_logo.png");
}
#image-dai-erc20-logo {
-fx-image: url("../../images/dai-erc20_logo.png");
}
#image-eth-logo {
-fx-image: url("../../images/eth_logo.png");
}
#image-ltc-logo {
-fx-image: url("../../images/ltc_logo.png");
}
#image-usdc-erc20-logo {
-fx-image: url("../../images/usdc-erc20_logo.png");
}
#image-usdt-erc20-logo {
-fx-image: url("../../images/usdt-erc20_logo.png");
}
#image-usdt-trc20-logo {
-fx-image: url("../../images/usdt-trc20_logo.png");
}
#image-xmr-logo {
-fx-image: url("../../images/xmr_logo.png");
}

View file

@ -67,6 +67,7 @@ import haveno.network.p2p.P2PService;
import javafx.collections.FXCollections;
import javafx.geometry.HPos;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
@ -79,6 +80,7 @@ import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
@ -431,33 +433,44 @@ public class GUIUtil {
HBox box = new HBox();
box.setSpacing(20);
Label currencyType = new AutoTooltipLabel(
CurrencyUtil.isTraditionalCurrency(item.getCode()) ? Res.get("shared.traditional") : Res.get("shared.crypto"));
currencyType.getStyleClass().add("currency-label-small");
Label label = new AutoTooltipLabel(
CurrencyUtil.isTraditionalCurrency(item.getCode()) ? Res.get("shared.traditional") : Res.get("shared.crypto"));
label.getStyleClass().add("currency-label-small");
Label currency = new AutoTooltipLabel(item.getCode());
currency.getStyleClass().add("currency-label");
Label offers = new AutoTooltipLabel(item.getName());
offers.getStyleClass().add("currency-label");
box.getChildren().addAll(currencyType, currency, offers);
Optional<Integer> offerCountOptional = Optional.ofNullable(offerCounts.get(code));
switch (code) {
case GUIUtil.SHOW_ALL_FLAG:
currencyType.setText(Res.get("shared.all"));
label.setText(Res.get("shared.all"));
currency.setText(Res.get("list.currency.showAll"));
break;
case GUIUtil.EDIT_FLAG:
currencyType.setText(Res.get("shared.edit"));
label.setText(Res.get("shared.edit"));
currency.setText(Res.get("list.currency.editList"));
break;
default:
// use icons for crypto
if (CurrencyUtil.isCryptoCurrency(item.getCode())) {
ImageView iconView = new ImageView();
iconView.setId("image-" + item.getCode().toLowerCase() + "-logo");
iconView.setFitHeight(24);
iconView.setFitWidth(24);
iconView.setSmooth(true);
label.setText("");
label.setGraphic(iconView);
}
offerCountOptional.ifPresent(numOffer -> offers.setText(offers.getText() + " (" + numOffer + " " +
(numOffer == 1 ? postFixSingle : postFixMulti) + ")"));
}
box.getChildren().addAll(label, currency, offers);
setGraphic(box);
} else {

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB