From 98f812620e755c704506540ebbf9064c21e10885 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 20 Dec 2024 05:23:12 -0500 Subject: [PATCH 1/3] fix no deposit filter applied to sell tab --- .../desktop/main/offer/offerbook/OfferBookViewModel.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java index 55fb0946c8..d0c9317274 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -579,7 +579,10 @@ private void filterOffers() { getCurrencyAndMethodPredicate(direction, selectedTradeCurrency).and(getOffersMatchingMyAccountsPredicate()) : getCurrencyAndMethodPredicate(direction, selectedTradeCurrency); - predicate = predicate.and(offerBookListItem -> offerBookListItem.getOffer().isPrivateOffer() == showPrivateOffers); + // filter private offers + if (direction == OfferDirection.BUY) { + predicate = predicate.and(offerBookListItem -> offerBookListItem.getOffer().isPrivateOffer() == showPrivateOffers); + } if (!filterText.isEmpty()) { From ef9b303deda8bc5c24cfb10c9b20f6845ce5f3f0 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 20 Dec 2024 11:45:42 -0500 Subject: [PATCH 2/3] fix ui to set security deposit pct w/o deposit --- .../main/offer/MutableOfferViewModel.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java index 8ededde35c..d92a0322d2 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java @@ -56,6 +56,7 @@ import haveno.core.util.validation.AmountValidator4Decimals; import haveno.core.util.validation.AmountValidator8Decimals; import haveno.core.util.validation.InputValidator; +import haveno.core.util.validation.InputValidator.ValidationResult; import haveno.core.util.validation.MonetaryValidator; import haveno.core.xmr.wallet.Restrictions; import haveno.desktop.Navigation; @@ -490,6 +491,8 @@ private void createListeners() { xmrValidator.setMaxTradeLimit(BigInteger.valueOf(dataModel.getMaxTradeLimit())); if (amount.get() != null) amountValidationResult.set(isXmrInputValid(amount.get())); updateSecurityDeposit(); + setSecurityDepositToModel(); + onFocusOutSecurityDepositTextField(true, false); // refresh security deposit field applyMakerFee(); dataModel.calculateTotalToPay(); updateButtonDisableState(); @@ -769,7 +772,8 @@ void onFocusOutAmountTextField(boolean oldValue, boolean newValue) { } } } - // We want to trigger a recalculation of the volume + + // trigger recalculation of the volume UserThread.execute(() -> { onFocusOutVolumeTextField(true, false); onFocusOutMinAmountTextField(true, false); @@ -815,6 +819,11 @@ public void onFocusOutMinAmountTextField(boolean oldValue, boolean newValue) { } maybeShowMakeOfferToUnsignedAccountWarning(); + + // trigger recalculation of the security deposit + UserThread.execute(() -> { + onFocusOutSecurityDepositTextField(true, false); + }); } } @@ -944,11 +953,16 @@ void onFocusOutVolumeTextField(boolean oldValue, boolean newValue) { if (marketPriceMargin.get() == null && amount.get() != null && volume.get() != null) { updateMarketPriceToManual(); } + + // trigger recalculation of security deposit + UserThread.execute(() -> { + onFocusOutSecurityDepositTextField(true, false); + }); } } void onFocusOutSecurityDepositTextField(boolean oldValue, boolean newValue) { - if (oldValue && !newValue) { + if (oldValue && !newValue && !isMinSecurityDeposit.get()) { InputValidator.ValidationResult result = securityDepositValidator.validate(securityDeposit.get()); securityDepositValidationResult.set(result); if (result.isValid) { @@ -1040,6 +1054,7 @@ public String getTradeAmount() { public String getSecurityDepositLabel() { return dataModel.buyerAsTakerWithoutDeposit.get() && dataModel.isSellOffer() ? Res.get("createOffer.myDeposit") : + dataModel.isMinSecurityDeposit() ? Res.get("createOffer.minSecurityDepositUsed") : Preferences.USE_SYMMETRIC_SECURITY_DEPOSIT ? Res.get("createOffer.setDepositForBothTraders") : dataModel.isBuyOffer() ? Res.get("createOffer.setDepositAsBuyer") : Res.get("createOffer.setDeposit"); } @@ -1211,7 +1226,7 @@ private void setVolumeToModel() { } private void setSecurityDepositToModel() { - if (!(dataModel.buyerAsTakerWithoutDeposit.get() && dataModel.isSellOffer()) && securityDeposit.get() != null && !securityDeposit.get().isEmpty()) { + if (securityDeposit.get() != null && !securityDeposit.get().isEmpty() && !isMinSecurityDeposit.get()) { dataModel.setSecurityDepositPct(ParsingUtils.parsePercentStringToDouble(securityDeposit.get())); } else { dataModel.setSecurityDepositPct(Restrictions.getDefaultSecurityDepositAsPercent()); @@ -1282,11 +1297,11 @@ private void updateSpinnerInfo() { private void updateSecurityDeposit() { isMinSecurityDeposit.set(dataModel.isMinSecurityDeposit()); + securityDepositLabel.set(getSecurityDepositLabel()); if (dataModel.isMinSecurityDeposit()) { - securityDepositLabel.set(Res.get("createOffer.minSecurityDepositUsed")); securityDeposit.set(HavenoUtils.formatXmr(Restrictions.getMinSecurityDeposit())); + securityDepositValidationResult.set(new ValidationResult(true)); } else { - securityDepositLabel.set(getSecurityDepositLabel()); boolean hasBuyerAsTakerWithoutDeposit = dataModel.buyerAsTakerWithoutDeposit.get() && dataModel.isSellOffer(); securityDeposit.set(FormattingUtils.formatToPercent(hasBuyerAsTakerWithoutDeposit ? Restrictions.getDefaultSecurityDepositAsPercent() : // use default percent if no deposit from buyer From 0ceaf4d40ceb3ee0c48addb25565cb52428a3251 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 20 Dec 2024 13:44:00 -0500 Subject: [PATCH 3/3] increase contrast of filter toggles and remove bottom highlight --- .../haveno/desktop/main/offer/offerbook/OfferBookView.java | 2 +- desktop/src/main/java/haveno/desktop/theme-dark.css | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java index 9b3571458f..b37aa340bb 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java @@ -185,7 +185,7 @@ public void initialize() { paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory()); paymentMethodComboBox.setPrefWidth(250); - matchingOffersToggleButton = AwesomeDude.createIconToggleButton(AwesomeIcon.USER, null, "1.3em", null); + matchingOffersToggleButton = AwesomeDude.createIconToggleButton(AwesomeIcon.USER, null, "1.5em", null); matchingOffersToggleButton.getStyleClass().add("toggle-button-no-slider"); matchingOffersToggleButton.setPrefHeight(27); Tooltip matchingOffersTooltip = new Tooltip(Res.get("offerbook.matchingOffers")); diff --git a/desktop/src/main/java/haveno/desktop/theme-dark.css b/desktop/src/main/java/haveno/desktop/theme-dark.css index 37903692ce..d045e3b5b0 100644 --- a/desktop/src/main/java/haveno/desktop/theme-dark.css +++ b/desktop/src/main/java/haveno/desktop/theme-dark.css @@ -561,8 +561,10 @@ .toggle-button-no-slider { -fx-focus-color: transparent; -fx-faint-focus-color: transparent; + -fx-background-radius: 3; + -fx-background-insets: 0, 1; } .toggle-button-no-slider:selected { - -fx-background-color: -bs-color-gray-ddd; + -fx-background-color: -bs-color-gray-bbb; }