From 31e8afaa7ed75550037ad3be7988bbed01eec3f2 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 17:46:02 +0200 Subject: [PATCH 1/7] Add fiat payment methods column in offerbook listview Resolves #2316 --- .../offerbook/BisqEasyOfferbookUtil.java | 30 +++++++++++++++++++ .../offerbook/BisqEasyOfferbookView.java | 13 +++++++- .../bisq_easy/offerbook/OfferMessageItem.java | 6 ++++ i18n/src/main/resources/bisq_easy.properties | 2 ++ .../bisq/offer/bisq_easy/BisqEasyOffer.java | 18 ++++++++++- 5 files changed, 67 insertions(+), 2 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java index 3ae2f0a3c3..4b0f85ada5 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java @@ -1,7 +1,9 @@ package bisq.desktop.main.content.bisq_easy.offerbook; +import bisq.account.payment_method.FiatPaymentMethod; import bisq.common.currency.Market; import bisq.common.currency.MarketRepository; +import bisq.desktop.common.utils.GridPaneUtil; import bisq.desktop.common.utils.ImageUtil; import bisq.desktop.components.containers.Spacer; import bisq.desktop.components.controls.Badge; @@ -22,6 +24,7 @@ import javafx.scene.control.TableRow; import javafx.scene.control.Tooltip; import javafx.scene.image.ImageView; +import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; @@ -276,4 +279,31 @@ protected void updateItem(OfferMessageItem item, boolean empty) { } }; } + + static Callback, + TableCell> getOfferMessagePaymentCellFactory() { + return column -> new TableCell<>() { + @Override + protected void updateItem(OfferMessageItem item, boolean empty) { + super.updateItem(item, empty); + + if (item != null && !empty) { + HBox hbox = new HBox(5); + hbox.setAlignment(Pos.CENTER_LEFT); + for (FiatPaymentMethod fiatPaymentMethod : item.getFiatPaymentMethods()) { + Label label = new Label(); + label.setGraphic(ImageUtil.getImageViewById(fiatPaymentMethod.getName())); + BisqTooltip tooltip = new BisqTooltip(); + tooltip.getStyleClass().add("medium-dark-tooltip"); + tooltip.setText(fiatPaymentMethod.getDisplayString()); + Tooltip.install(label, tooltip); + hbox.getChildren().add(label); + } + setGraphic(hbox); + } else { + setGraphic(null); + } + } + }; + } } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 7f42056126..6d15b42f59 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -52,7 +52,7 @@ public final class BisqEasyOfferbookView extends ChatView { private static final String BUY_FROM_MENU_ITEM_STYLE_CLASS = "buy-from-offers"; private static final String SELL_TO_MENU_ITEM_STYLE_CLASS = "sell-to-offers"; - private static final double EXPANDED_OFFER_LIST_WIDTH = 438; + private static final double EXPANDED_OFFER_LIST_WIDTH = 600;//438; private static final double EXPANDED_MARKET_SELECTION_LIST_WIDTH = 210; private static final double COLLAPSED_LIST_WIDTH = 40; @@ -132,6 +132,7 @@ protected void onViewAttached() { favouritesTableView.initialize(); marketsTableView.initialize(); + offerListTableView.initialize(); marketSelectorSearchBox.textProperty().bindBidirectional(getModel().getMarketSelectorSearchText()); marketPrice.textProperty().bind(getModel().getMarketPrice()); @@ -241,6 +242,7 @@ protected void onViewDetached() { marketsTableView.dispose(); favouritesTableView.dispose(); + offerListTableView.dispose(); marketSelectorSearchBox.textProperty().unbindBidirectional(getModel().getMarketSelectorSearchText()); marketPrice.textProperty().unbind(); @@ -683,11 +685,20 @@ private void configOffersTableView(BisqTableView tableView) { .isSortable(true) .build(); + BisqTableColumn paymentTableColumn = new BisqTableColumn.Builder() + .title(Res.get("bisqEasy.offerbook.offerList.table.columns.paymentMethod")) + .left() + .fixWidth(120) + .setCellFactory(BisqEasyOfferbookUtil.getOfferMessagePaymentCellFactory()) + .isSortable(false) + .build(); + tableView.getColumns().add(tableView.getSelectionMarkerColumn()); tableView.getColumns().add(userProfileTableColumn); tableView.getColumns().add(priceTableColumn); tableView.getColumns().add(spacerColumn); tableView.getColumns().add(fiatAmountTableColumn); + tableView.getColumns().add(paymentTableColumn); tableView.getSortOrder().add(userProfileTableColumn); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java index 744269d979..f5c1f4500f 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java @@ -17,6 +17,7 @@ package bisq.desktop.main.content.bisq_easy.offerbook; +import bisq.account.payment_method.FiatPaymentMethod; import bisq.bonded_roles.market_price.MarketPriceService; import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookMessage; import bisq.common.data.Pair; @@ -27,6 +28,7 @@ import bisq.offer.amount.OfferAmountFormatter; import bisq.offer.amount.OfferAmountUtil; import bisq.offer.bisq_easy.BisqEasyOffer; +import bisq.offer.payment_method.PaymentMethodSpecUtil; import bisq.offer.price.PriceUtil; import bisq.presentation.formatters.TimeFormatter; import bisq.user.profile.UserProfile; @@ -39,6 +41,8 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import java.util.List; + @Slf4j @Getter @EqualsAndHashCode(onlyExplicitlyIncluded = true) @@ -55,6 +59,7 @@ public class OfferMessageItem { private final long lastSeen; private final String lastSeenAsString; private final ObjectProperty reputationScore = new SimpleObjectProperty<>(); + private final List fiatPaymentMethods; private long totalScore; private double priceSpecAsPercent; private Pin marketPriceByCurrencyMapPin, reputationChangedPin; @@ -69,6 +74,7 @@ public class OfferMessageItem { this.userProfile = userProfile; this.reputationService = reputationService; this.marketPriceService = marketPriceService; + this.fiatPaymentMethods = PaymentMethodSpecUtil.getPaymentMethods(bisqEasyOffer.getQuoteSidePaymentMethodSpecs()); userNickname = userProfile.getNickName(); minMaxAmount = retrieveMinMaxAmount(); minMaxAmountAsString = OfferAmountFormatter.formatQuoteAmount(marketPriceService, bisqEasyOffer, false); diff --git a/i18n/src/main/resources/bisq_easy.properties b/i18n/src/main/resources/bisq_easy.properties index 4223091af5..4100a2797b 100644 --- a/i18n/src/main/resources/bisq_easy.properties +++ b/i18n/src/main/resources/bisq_easy.properties @@ -442,6 +442,8 @@ bisqEasy.offerbook.offerList.ExpandedList.Tooltip=Collapse Offer List bisqEasy.offerbook.offerList.table.columns.peerProfile=Peer profile bisqEasy.offerbook.offerList.table.columns.price=Price bisqEasy.offerbook.offerList.table.columns.fiatAmount={0} amount +bisqEasy.offerbook.offerList.table.columns.paymentMethod=Payment +bisqEasy.offerbook.offerList.table.columns.settlementMethod=Settlement bisqEasy.offerbook.offerList.table.filters.offerDirection.buyFrom=Buy from bisqEasy.offerbook.offerList.table.filters.offerDirection.sellTo=Sell to diff --git a/offer/src/main/java/bisq/offer/bisq_easy/BisqEasyOffer.java b/offer/src/main/java/bisq/offer/bisq_easy/BisqEasyOffer.java index ba48fe6718..dc7d1f58cd 100644 --- a/offer/src/main/java/bisq/offer/bisq_easy/BisqEasyOffer.java +++ b/offer/src/main/java/bisq/offer/bisq_easy/BisqEasyOffer.java @@ -1,5 +1,21 @@ -package bisq.offer.bisq_easy; +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ +package bisq.offer.bisq_easy; import bisq.account.payment_method.BitcoinPaymentMethod; import bisq.account.payment_method.FiatPaymentMethod; From e35279b93b902bf4b4fceefe035725867623594f Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 18:06:22 +0200 Subject: [PATCH 2/7] Sort payment methods in listview column --- .../bisq_easy/offerbook/BisqEasyOfferbookUtil.java | 2 -- .../bisq_easy/offerbook/BisqEasyOfferbookView.java | 4 +--- .../content/bisq_easy/offerbook/OfferMessageItem.java | 11 ++++++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java index 4b0f85ada5..25a7dac17b 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java @@ -3,7 +3,6 @@ import bisq.account.payment_method.FiatPaymentMethod; import bisq.common.currency.Market; import bisq.common.currency.MarketRepository; -import bisq.desktop.common.utils.GridPaneUtil; import bisq.desktop.common.utils.ImageUtil; import bisq.desktop.components.containers.Spacer; import bisq.desktop.components.controls.Badge; @@ -24,7 +23,6 @@ import javafx.scene.control.TableRow; import javafx.scene.control.Tooltip; import javafx.scene.image.ImageView; -import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 6d15b42f59..6e91b7921e 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -52,7 +52,7 @@ public final class BisqEasyOfferbookView extends ChatView { private static final String BUY_FROM_MENU_ITEM_STYLE_CLASS = "buy-from-offers"; private static final String SELL_TO_MENU_ITEM_STYLE_CLASS = "sell-to-offers"; - private static final double EXPANDED_OFFER_LIST_WIDTH = 600;//438; + private static final double EXPANDED_OFFER_LIST_WIDTH = 558; private static final double EXPANDED_MARKET_SELECTION_LIST_WIDTH = 210; private static final double COLLAPSED_LIST_WIDTH = 40; @@ -132,7 +132,6 @@ protected void onViewAttached() { favouritesTableView.initialize(); marketsTableView.initialize(); - offerListTableView.initialize(); marketSelectorSearchBox.textProperty().bindBidirectional(getModel().getMarketSelectorSearchText()); marketPrice.textProperty().bind(getModel().getMarketPrice()); @@ -242,7 +241,6 @@ protected void onViewDetached() { marketsTableView.dispose(); favouritesTableView.dispose(); - offerListTableView.dispose(); marketSelectorSearchBox.textProperty().unbindBidirectional(getModel().getMarketSelectorSearchText()); marketPrice.textProperty().unbind(); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java index f5c1f4500f..a44226fa7e 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java @@ -41,6 +41,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import java.util.Comparator; import java.util.List; @Slf4j @@ -74,7 +75,7 @@ public class OfferMessageItem { this.userProfile = userProfile; this.reputationService = reputationService; this.marketPriceService = marketPriceService; - this.fiatPaymentMethods = PaymentMethodSpecUtil.getPaymentMethods(bisqEasyOffer.getQuoteSidePaymentMethodSpecs()); + this.fiatPaymentMethods = retrieveAndSortFiatPaymentMethods(); userNickname = userProfile.getNickName(); minMaxAmount = retrieveMinMaxAmount(); minMaxAmountAsString = OfferAmountFormatter.formatQuoteAmount(marketPriceService, bisqEasyOffer, false); @@ -121,4 +122,12 @@ private void updateReputationScore() { reputationScore.set(reputationService.getReputationScore(userProfile)); totalScore = reputationScore.get().getTotalScore(); } + + private List retrieveAndSortFiatPaymentMethods() { + List paymentMethods = + PaymentMethodSpecUtil.getPaymentMethods(bisqEasyOffer.getQuoteSidePaymentMethodSpecs()); + paymentMethods.sort(Comparator.comparing(FiatPaymentMethod::isCustomPaymentMethod) + .thenComparing(FiatPaymentMethod::getDisplayString)); + return paymentMethods; + } } From 8064848d199bdc48f693f6ed0f37963bd6c61e8e Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 18:35:26 +0200 Subject: [PATCH 3/7] Add settlement methods column in listview --- .../offerbook/BisqEasyOfferbookUtil.java | 28 +++++++++++++++++++ .../offerbook/BisqEasyOfferbookView.java | 12 +++++++- .../bisq_easy/offerbook/OfferMessageItem.java | 21 ++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java index 25a7dac17b..c58ca4bb49 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java @@ -1,5 +1,6 @@ package bisq.desktop.main.content.bisq_easy.offerbook; +import bisq.account.payment_method.BitcoinPaymentMethod; import bisq.account.payment_method.FiatPaymentMethod; import bisq.common.currency.Market; import bisq.common.currency.MarketRepository; @@ -304,4 +305,31 @@ protected void updateItem(OfferMessageItem item, boolean empty) { } }; } + + static Callback, + TableCell> getOfferMessageSettlementCellFactory() { + return column -> new TableCell<>() { + @Override + protected void updateItem(OfferMessageItem item, boolean empty) { + super.updateItem(item, empty); + + if (item != null && !empty) { + HBox hbox = new HBox(5); + hbox.setAlignment(Pos.CENTER_LEFT); + for (BitcoinPaymentMethod bitcoinPaymentMethod : item.getBitcoinPaymentMethods()) { + Label label = new Label(); + label.setGraphic(ImageUtil.getImageViewById(bitcoinPaymentMethod.getName())); + BisqTooltip tooltip = new BisqTooltip(); + tooltip.getStyleClass().add("medium-dark-tooltip"); + tooltip.setText(bitcoinPaymentMethod.getDisplayString()); + Tooltip.install(label, tooltip); + hbox.getChildren().add(label); + } + setGraphic(hbox); + } else { + setGraphic(null); + } + } + }; + } } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 6e91b7921e..0a5e6b73d3 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -52,7 +52,7 @@ public final class BisqEasyOfferbookView extends ChatView { private static final String BUY_FROM_MENU_ITEM_STYLE_CLASS = "buy-from-offers"; private static final String SELL_TO_MENU_ITEM_STYLE_CLASS = "sell-to-offers"; - private static final double EXPANDED_OFFER_LIST_WIDTH = 558; + private static final double EXPANDED_OFFER_LIST_WIDTH = 678; private static final double EXPANDED_MARKET_SELECTION_LIST_WIDTH = 210; private static final double COLLAPSED_LIST_WIDTH = 40; @@ -691,12 +691,22 @@ private void configOffersTableView(BisqTableView tableView) { .isSortable(false) .build(); + BisqTableColumn settlementTableColumn = new BisqTableColumn.Builder() + .title(Res.get("bisqEasy.offerbook.offerList.table.columns.settlementMethod")) + .left() + .fixWidth(120) + .setCellFactory(BisqEasyOfferbookUtil.getOfferMessageSettlementCellFactory()) + .comparator(Comparator.comparing(OfferMessageItem::getBitcoinPaymentMethodsAsString)) + .isSortable(true) + .build(); + tableView.getColumns().add(tableView.getSelectionMarkerColumn()); tableView.getColumns().add(userProfileTableColumn); tableView.getColumns().add(priceTableColumn); tableView.getColumns().add(spacerColumn); tableView.getColumns().add(fiatAmountTableColumn); tableView.getColumns().add(paymentTableColumn); + tableView.getColumns().add(settlementTableColumn); tableView.getSortOrder().add(userProfileTableColumn); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java index a44226fa7e..c19fa17f1f 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java @@ -17,6 +17,7 @@ package bisq.desktop.main.content.bisq_easy.offerbook; +import bisq.account.payment_method.BitcoinPaymentMethod; import bisq.account.payment_method.FiatPaymentMethod; import bisq.bonded_roles.market_price.MarketPriceService; import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookMessage; @@ -61,6 +62,8 @@ public class OfferMessageItem { private final String lastSeenAsString; private final ObjectProperty reputationScore = new SimpleObjectProperty<>(); private final List fiatPaymentMethods; + private final List bitcoinPaymentMethods; + private final String bitcoinPaymentMethodsAsString; private long totalScore; private double priceSpecAsPercent; private Pin marketPriceByCurrencyMapPin, reputationChangedPin; @@ -76,6 +79,8 @@ public class OfferMessageItem { this.reputationService = reputationService; this.marketPriceService = marketPriceService; this.fiatPaymentMethods = retrieveAndSortFiatPaymentMethods(); + this.bitcoinPaymentMethods = retrieveAndSortBitcoinPaymentMethods(); + this.bitcoinPaymentMethodsAsString = createBitcoinPaymentMethodsAsString(); userNickname = userProfile.getNickName(); minMaxAmount = retrieveMinMaxAmount(); minMaxAmountAsString = OfferAmountFormatter.formatQuoteAmount(marketPriceService, bisqEasyOffer, false); @@ -130,4 +135,20 @@ private List retrieveAndSortFiatPaymentMethods() { .thenComparing(FiatPaymentMethod::getDisplayString)); return paymentMethods; } + + private List retrieveAndSortBitcoinPaymentMethods() { + List paymentMethods = + PaymentMethodSpecUtil.getPaymentMethods(bisqEasyOffer.getBaseSidePaymentMethodSpecs()); + paymentMethods.sort(Comparator.comparing(BitcoinPaymentMethod::getDisplayString).reversed()); + return paymentMethods; + } + + private String createBitcoinPaymentMethodsAsString() { + StringBuilder builder = new StringBuilder(); + for (BitcoinPaymentMethod bitcoinPaymentMethod : bitcoinPaymentMethods) { + builder.append(bitcoinPaymentMethod.getDisplayString()); + builder.append(", "); + } + return builder.toString(); + } } From 069dcdfcc26a2ded7ef2c3bb90aba467ee98b893 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 18:43:09 +0200 Subject: [PATCH 4/7] Add custom payment icons --- .../desktop/src/main/resources/css/images.css | 12 ++++++++++++ .../resources/images/payment/custom-payment-1.png | Bin 0 -> 232 bytes .../images/payment/custom-payment-1@2x.png | Bin 0 -> 325 bytes .../resources/images/payment/custom-payment-2.png | Bin 0 -> 232 bytes .../images/payment/custom-payment-2@2x.png | Bin 0 -> 326 bytes .../resources/images/payment/custom-payment-3.png | Bin 0 -> 232 bytes .../images/payment/custom-payment-3@2x.png | Bin 0 -> 326 bytes 7 files changed, 12 insertions(+) create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1.png create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1@2x.png create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-2.png create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-2@2x.png create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-3.png create mode 100644 apps/desktop/desktop/src/main/resources/images/payment/custom-payment-3@2x.png diff --git a/apps/desktop/desktop/src/main/resources/css/images.css b/apps/desktop/desktop/src/main/resources/css/images.css index 4cce7f6a38..5450586278 100644 --- a/apps/desktop/desktop/src/main/resources/css/images.css +++ b/apps/desktop/desktop/src/main/resources/css/images.css @@ -611,6 +611,18 @@ -fx-image: url("/images/payment/cashapp-.png"); } +#CUSTOM_PAYMENT_1 { + -fx-image: url("/images/payment/custom-payment-1.png"); +} + +#CUSTOM_PAYMENT_2 { + -fx-image: url("/images/payment/custom-payment-2.png"); +} + +#CUSTOM_PAYMENT_3 { + -fx-image: url("/images/payment/custom-payment-3.png"); +} + #add-custom-green { -fx-image: url("/images/payment/add-custom-green.png"); } diff --git a/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1.png b/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1.png new file mode 100644 index 0000000000000000000000000000000000000000..f2ad0b723c43bc2985d023e481ae016844a0da37 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8E>9Q7kcwMLcg)lIm_;-g3hf1?88$L77d~JXh-Y}@q)^8o zl+fs<;=rqXO+iAS!RiQO)(a*zmFW|+Bz7HCFcz7yB0-{Sq0a?_#bO2tizdB(ur4KO zfsur1!Ic9ClOC{Z&HCQR88t7EJ0_uNTJn_w)e}8VY8js1D;LTqEHztmB#z+-`-(tT c1{Mj1wgl-%g5huX0bRx5>FVdQ&MBb@01T{41^@s6 literal 0 HcmV?d00001 diff --git a/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1@2x.png b/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-1@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..5e084499809d8e1b3ddc7008534ae34bab264acc GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xo_o4DhE&{obLAmtvw;BX0~6sCR`Zu^X)Jdg)HgD76tcuF z*x?y|f@AL#?@po2|0Zz{Z7USQcJ`Y*E0TAg+PTo|%B-r;{b#*mR|sEyUw>t$xYes> zE0F`5^9(&i)APK&MIU!-I%eY*83(}j6kp6|Ok zIqY+wl4)s-9Q7kcwMLbN1G2GK*+16xs_&Gi+pFE_}c&5YO<)NuiEG zD523y#erA(nu3HtgVhnntQSmbD$^%sN$fhPU@S6YMS?`vLZ1r;i^U8Q7EOBnU|mYm z0wW32f-46OCOu%+n)SVrGiqKScT7UlwB#!VswaA!)G|E1S1y!KSZcQBNF2iv_7#Dw c3@j21`^BVRi%kmh1iFgB)78&qol`;+07vagrvLx| literal 0 HcmV?d00001 diff --git a/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-2@2x.png b/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-2@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e1d6684e7631c12a08a500d6e5c12c8da20135d6 GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XUU<4VhE&{obLAj!lYt1^gIk=tm}c)_lw~w)@ci&@Va%Sx zESoyDOIYI1uGU=QqCYMD)Blt61zPs#Z~aoT_kM_4+pU1?SCN0sxJ#Gyh3x+um>&0H z1^=r6hUFE<4jAwDcR0>39ctH>zT0-em}my6o2x#!a&7VCrBkO}594;IzA*21 znt#+;_s%O<3R#yP%Tl#rVB%0{KqCHG7YMzX%~T-9Gv_f^RilM`xIxSprpAL$9=jVA zEq(IVbN{0-j-nLrZ!9Q7kcwMLF`J%9FpFp~6xs_&Gi+pFE_}c&5YO<)NuiEG zD523y#erA(nu3HtgVhnntQSmbD$^%sN$fhPU@S6YMS?`vLZ1r;i^U8Q7EOBnU|mYm z0wW32f-46OCOu%+n)SVrGiqKScT7UlwB#!VswaA!)G|E1S1y!KSZcQBNF2iv_7#Dw c3@j21vbUvwF_u562D*yD)78&qol`;+09Qv#b^rhX literal 0 HcmV?d00001 diff --git a/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-3@2x.png b/apps/desktop/desktop/src/main/resources/images/payment/custom-payment-3@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3f339736dd21de90391215595bbadb7de0f80c28 GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XUU<4VhE&{obLAp$lYt29g(kaS4by(eDB!@r$buj~+;7~Ra9^gOJK=#)_yz7GKX)`eTqMrHqb6@J zbbRWh?dpHKq7^-kPkUo{`Pfq1%=2G0-@TC86R2HRq010m8FqBDc_o(t!@C-dxc9#g RO$Pdz!PC{xWt~$(69AW6g7N?W literal 0 HcmV?d00001 From 52cdf4a293464f5ba7f3e9bdc1275076cda3024e Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 19:45:52 +0200 Subject: [PATCH 5/7] Use custom method icons --- .../content/bisq_easy/BisqEasyViewUtils.java | 24 ++++++++++++++++++- .../offerbook/BisqEasyOfferbookUtil.java | 6 ++++- .../open_trades/BisqEasyOpenTradesView.java | 9 +++++-- .../payment_methods/TakeOfferPaymentView.java | 11 +++++---- .../TradeWizardPaymentMethodsView.java | 4 ++++ .../src/main/resources/css/bisq_easy.css | 7 ++++++ 6 files changed, 53 insertions(+), 8 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/BisqEasyViewUtils.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/BisqEasyViewUtils.java index 101809a463..55241bc5d3 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/BisqEasyViewUtils.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/BisqEasyViewUtils.java @@ -19,14 +19,22 @@ import bisq.common.data.Triple; import bisq.desktop.common.Layout; +import bisq.desktop.common.utils.ImageUtil; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Label; +import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; +import java.util.Random; + public class BisqEasyViewUtils { + private static final String[] customPaymentIconIds = {"CUSTOM_PAYMENT_1", "CUSTOM_PAYMENT_2", "CUSTOM_PAYMENT_3"}; + private static final Random random = new Random(); + public static Triple getContainer(String headline, Node content) { Label headlineLabel = new Label(headline); headlineLabel.getStyleClass().add("bisq-easy-container-headline"); @@ -43,4 +51,18 @@ public static Triple getContainer(String headline, Node conte return new Triple<>(headlineLabel, header, vBox); } -} \ No newline at end of file + + public static StackPane getCustomPaymentMethodIcon(String customPaymentMethod) { + char initial = customPaymentMethod.charAt(0); + + Label initialLabel = new Label(String.valueOf(initial)); + initialLabel.getStyleClass().add("bisq-easy-custom-payment-icon"); + + int iconIndex = random.nextInt(customPaymentIconIds.length); + ImageView customPaymentIcon = ImageUtil.getImageViewById(customPaymentIconIds[iconIndex]); + + StackPane stackPane = new StackPane(customPaymentIcon, initialLabel); + stackPane.setAlignment(Pos.CENTER); + return stackPane; + } +} diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java index c58ca4bb49..8894fb2f73 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookUtil.java @@ -8,6 +8,7 @@ import bisq.desktop.components.containers.Spacer; import bisq.desktop.components.controls.Badge; import bisq.desktop.components.controls.BisqTooltip; +import bisq.desktop.main.content.bisq_easy.BisqEasyViewUtils; import bisq.desktop.main.content.components.ReputationScoreDisplay; import bisq.desktop.main.content.components.UserProfileIcon; import bisq.i18n.Res; @@ -291,7 +292,10 @@ protected void updateItem(OfferMessageItem item, boolean empty) { hbox.setAlignment(Pos.CENTER_LEFT); for (FiatPaymentMethod fiatPaymentMethod : item.getFiatPaymentMethods()) { Label label = new Label(); - label.setGraphic(ImageUtil.getImageViewById(fiatPaymentMethod.getName())); + Node paymentMethodIcon = !fiatPaymentMethod.isCustomPaymentMethod() + ? ImageUtil.getImageViewById(fiatPaymentMethod.getName()) + : BisqEasyViewUtils.getCustomPaymentMethodIcon(fiatPaymentMethod.getDisplayString().toUpperCase()); + label.setGraphic(paymentMethodIcon); BisqTooltip tooltip = new BisqTooltip(); tooltip.getStyleClass().add("medium-dark-tooltip"); tooltip.setText(fiatPaymentMethod.getDisplayString()); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/open_trades/BisqEasyOpenTradesView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/open_trades/BisqEasyOpenTradesView.java index 528948f8a7..46b3c56104 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/open_trades/BisqEasyOpenTradesView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/open_trades/BisqEasyOpenTradesView.java @@ -54,6 +54,7 @@ import javafx.geometry.Insets; import javafx.geometry.Point2D; import javafx.geometry.Pos; +import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; @@ -481,8 +482,10 @@ public void updateItem(final ListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { - ImageView icon = ImageUtil.getImageViewById(item.getFiatPaymentRail().name()); - StackPane pane = new StackPane(icon); + Node paymentMethodIcon = !item.isFiatPaymentMethodCustom() + ? ImageUtil.getImageViewById(item.getFiatPaymentRail().name()) + : BisqEasyViewUtils.getCustomPaymentMethodIcon(item.getFiatPaymentMethod().toUpperCase()); + StackPane pane = new StackPane(paymentMethodIcon); pane.setAlignment(Pos.CENTER_RIGHT); tooltip.setText(Res.get("bisqEasy.openTrades.table.paymentMethod.tooltip", item.getFiatPaymentMethod())); @@ -552,6 +555,7 @@ static class ListItem implements DateTableItem { private final long myselfLastSeen, peerLastSeen; private final BitcoinPaymentRail bitcoinPaymentRail; private final FiatPaymentRail fiatPaymentRail; + private final boolean isFiatPaymentMethodCustom; private long peerNumNotifications, mediatorNumNotifications; private String mediatorUserName = ""; @@ -590,6 +594,7 @@ public ListItem(BisqEasyOpenTradeChannel channel, fiatPaymentRail = contract.getQuoteSidePaymentMethodSpec().getPaymentMethod().getPaymentRail(); bitcoinSettlementMethod = contract.getBaseSidePaymentMethodSpec().getShortDisplayString(); fiatPaymentMethod = contract.getQuoteSidePaymentMethodSpec().getShortDisplayString(); + isFiatPaymentMethodCustom = contract.getQuoteSidePaymentMethodSpec().getPaymentMethod().isCustomPaymentMethod(); myRole = BisqEasyTradeFormatter.getMakerTakerRole(trade); reputationScore = reputationService.getReputationScore(peersUserProfile); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/take_offer/payment_methods/TakeOfferPaymentView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/take_offer/payment_methods/TakeOfferPaymentView.java index 763e76c2a3..ff3e205e6e 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/take_offer/payment_methods/TakeOfferPaymentView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/take_offer/payment_methods/TakeOfferPaymentView.java @@ -24,14 +24,17 @@ import bisq.desktop.common.view.View; import bisq.desktop.components.containers.Spacer; import bisq.desktop.components.controls.ChipToggleButton; +import bisq.desktop.main.content.bisq_easy.BisqEasyViewUtils; import bisq.offer.payment_method.BitcoinPaymentMethodSpec; import bisq.offer.payment_method.FiatPaymentMethodSpec; import javafx.geometry.Insets; import javafx.geometry.Pos; +import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.ToggleGroup; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.text.TextAlignment; import lombok.extern.slf4j.Slf4j; @@ -103,10 +106,10 @@ protected void onViewAttached() { for (FiatPaymentMethodSpec spec : model.getSortedFiatPaymentMethodSpecs()) { FiatPaymentMethod paymentMethod = spec.getPaymentMethod(); ChipToggleButton chipToggleButton = new ChipToggleButton(paymentMethod.getShortDisplayString(), fiatToggleGroup); - if (!paymentMethod.isCustomPaymentMethod()) { - ImageView icon = ImageUtil.getImageViewById(paymentMethod.getName()); - chipToggleButton.setLeftIcon(icon); - } + Node icon = !paymentMethod.isCustomPaymentMethod() + ? ImageUtil.getImageViewById(paymentMethod.getName()) + : BisqEasyViewUtils.getCustomPaymentMethodIcon(paymentMethod.getDisplayString()); + chipToggleButton.setLeftIcon(icon); chipToggleButton.setOnAction(() -> controller.onToggleFiatPaymentMethod(spec, chipToggleButton.isSelected())); chipToggleButton.setSelected(spec.equals(model.getSelectedFiatPaymentMethodSpec().get())); fiatGridPane.add(chipToggleButton, col++, row); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/payment_methods/TradeWizardPaymentMethodsView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/payment_methods/TradeWizardPaymentMethodsView.java index 6d172a3f18..4a3fbc4688 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/payment_methods/TradeWizardPaymentMethodsView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/payment_methods/TradeWizardPaymentMethodsView.java @@ -26,6 +26,7 @@ import bisq.desktop.components.containers.Spacer; import bisq.desktop.components.controls.BisqTooltip; import bisq.desktop.components.controls.ChipButton; +import bisq.desktop.main.content.bisq_easy.BisqEasyViewUtils; import bisq.i18n.Res; import javafx.collections.ListChangeListener; import javafx.geometry.Insets; @@ -33,6 +34,7 @@ import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.text.TextAlignment; import lombok.extern.slf4j.Slf4j; @@ -177,6 +179,8 @@ private void setUpAndFillFiatPaymentMethods() { customMethod -> { ImageView closeIcon = chipButton.setRightIcon("remove-white"); closeIcon.setOnMousePressed(e -> controller.onRemoveFiatCustomMethod(fiatPaymentMethod)); + StackPane icon = BisqEasyViewUtils.getCustomPaymentMethodIcon(customMethod.getDisplayString()); + chipButton.setLeftIcon(icon); }, () -> { // Lookup for an image with the id of the enum name (REVOLUT) diff --git a/apps/desktop/desktop/src/main/resources/css/bisq_easy.css b/apps/desktop/desktop/src/main/resources/css/bisq_easy.css index 646f75c492..58acc5980d 100644 --- a/apps/desktop/desktop/src/main/resources/css/bisq_easy.css +++ b/apps/desktop/desktop/src/main/resources/css/bisq_easy.css @@ -1154,6 +1154,13 @@ -fx-text-fill: -fx-light-text-color; } +.bisq-easy-custom-payment-icon .text { + -fx-font-size: 1.2em; + -fx-font-family: "IBM Plex Sans Bold"; + -fx-text-fill: -fx-dark-text-color !important; + -fx-fill: -fx-dark-text-color !important; +} + /******************************************************************************* * * From 349fc0342f478217549e6b0cc2deaaa30a976b81 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 19:56:47 +0200 Subject: [PATCH 6/7] Use unicode for the asterisk symbol --- .../main/content/bisq_easy/offerbook/MarketChannelItem.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/MarketChannelItem.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/MarketChannelItem.java index a8d823693f..0098e29c2b 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/MarketChannelItem.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/MarketChannelItem.java @@ -44,6 +44,7 @@ public class MarketChannelItem { private static final ColorAdjust DEFAULT_COLOR_ADJUST = new ColorAdjust(); private static final ColorAdjust SELECTED_COLOR_ADJUST = new ColorAdjust(); + public static final String ASTERISK_SYMBOL = "\u002A"; // Unicode for "*" @EqualsAndHashCode.Include private final BisqEasyOfferbookChannel channel; @@ -101,7 +102,7 @@ private void applyNotification(ChatNotification notification) { if (numNotifications > 9) { // We don't have enough space for 2-digit numbers, so we show an asterix. Standard asterix would not be // centered, thus we use the `full width asterisk` taken from https://www.piliapp.com/symbol/asterisk/ - value = "*"; + value = ASTERISK_SYMBOL; } else if (numNotifications > 0) { value = String.valueOf(numNotifications); } From 5047c5e4ae93ac323c43225b6d837594e687876f Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 3 Aug 2024 20:20:26 +0200 Subject: [PATCH 7/7] Refactor: remove unnecessary this --- .../content/bisq_easy/offerbook/OfferMessageItem.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java index c19fa17f1f..427fefae93 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/OfferMessageItem.java @@ -74,13 +74,13 @@ public class OfferMessageItem { MarketPriceService marketPriceService, UserProfileService userProfileService) { this.bisqEasyOfferbookMessage = bisqEasyOfferbookMessage; - this.bisqEasyOffer = bisqEasyOfferbookMessage.getBisqEasyOffer().orElseThrow(); + bisqEasyOffer = bisqEasyOfferbookMessage.getBisqEasyOffer().orElseThrow(); this.userProfile = userProfile; this.reputationService = reputationService; this.marketPriceService = marketPriceService; - this.fiatPaymentMethods = retrieveAndSortFiatPaymentMethods(); - this.bitcoinPaymentMethods = retrieveAndSortBitcoinPaymentMethods(); - this.bitcoinPaymentMethodsAsString = createBitcoinPaymentMethodsAsString(); + fiatPaymentMethods = retrieveAndSortFiatPaymentMethods(); + bitcoinPaymentMethods = retrieveAndSortBitcoinPaymentMethods(); + bitcoinPaymentMethodsAsString = createBitcoinPaymentMethodsAsString(); userNickname = userProfile.getNickName(); minMaxAmount = retrieveMinMaxAmount(); minMaxAmountAsString = OfferAmountFormatter.formatQuoteAmount(marketPriceService, bisqEasyOffer, false);