From e0bd79f17249965b5f27e19b6a7f0283f929f8ea Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 16 Aug 2018 11:32:28 +0200 Subject: [PATCH] Add rounded fiat value info popup --- .../desktop/main/offer/MutableOfferView.java | 4 +++ .../main/offer/takeoffer/TakeOfferView.java | 27 ++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 1e47b73ffa9..43b46c01c19 100644 --- a/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -723,6 +723,10 @@ private void createListeners() { volumeListener = (observable, oldValue, newValue) -> { if (!newValue.equals("") && CurrencyUtil.isFiatCurrency(model.tradeCurrencyCode.get())) { volumeInfoInputTextField.setContentForPrivacyPopOver(createPopoverLabel(Res.get("offerbook.info.roundedFiatVolume"))); + new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline")) + .information(Res.get("popup.roundedFiatValues.msg", model.tradeCurrencyCode.get())) + .dontShowAgainId("FiatValuesRoundedWarning") + .show(); } }; diff --git a/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java b/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java index 711ae5b6558..b5605be686e 100644 --- a/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java @@ -145,7 +145,6 @@ public class TakeOfferView extends ActivatableViewAndModel amountFocusedListener; private Subscription cancelButton2StyleSubscription, balanceSubscription, showTransactionPublishedScreenSubscription, showWarningInvalidBtcDecimalPlacesSubscription, isWaitingForFundsSubscription, offerWarningSubscription, errorMessageSubscription, @@ -154,7 +153,7 @@ public class TakeOfferView extends ActivatableViewAndModel getShowWalletFundedNotificationListener; + private ChangeListener amountFocusedListener, getShowWalletFundedNotificationListener; private InfoTextField volumeInfoTextField; /////////////////////////////////////////////////////////////////////////////////////////// @@ -212,8 +211,7 @@ protected void initialize() { protected void activate() { addBindings(); addSubscriptions(); - - amountTextField.focusedProperty().addListener(amountFocusedListener); + addListeners(); if (offerAvailabilityBusyAnimation != null && !model.showPayFundsScreenDisplayed.get()) { offerAvailabilityBusyAnimation.play(); @@ -253,23 +251,25 @@ protected void activate() { showNextStepAfterAmountIsSet(); } - // notifications - model.dataModel.getShowWalletFundedNotification().addListener(getShowWalletFundedNotificationListener); + if (CurrencyUtil.isFiatCurrency(model.getOffer().getCurrencyCode())) { + new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline")) + .information(Res.get("popup.roundedFiatValues.msg", model.getOffer().getCurrencyCode())) + .dontShowAgainId("FiatValuesRoundedWarning") + .show(); + } } @Override protected void deactivate() { removeBindings(); removeSubscriptions(); - amountTextField.focusedProperty().removeListener(amountFocusedListener); + removeListeners(); if (offerAvailabilityBusyAnimation != null) offerAvailabilityBusyAnimation.stop(); if (waitingForFundsBusyAnimation != null) waitingForFundsBusyAnimation.stop(); - - model.dataModel.getShowWalletFundedNotification().removeListener(getShowWalletFundedNotificationListener); } /////////////////////////////////////////////////////////////////////////////////////////// @@ -664,6 +664,15 @@ private void removeSubscriptions() { cancelButton2StyleSubscription.unsubscribe(); } + private void addListeners() { + amountTextField.focusedProperty().addListener(amountFocusedListener); + model.dataModel.getShowWalletFundedNotification().addListener(getShowWalletFundedNotificationListener); + } + + private void removeListeners() { + amountTextField.focusedProperty().removeListener(amountFocusedListener); + model.dataModel.getShowWalletFundedNotification().removeListener(getShowWalletFundedNotificationListener); + } /////////////////////////////////////////////////////////////////////////////////////////// // Build UI elements