Skip to content

Commit

Permalink
Merge pull request #1629 from ripcurlx/add-new-feature-popup-for-roun…
Browse files Browse the repository at this point in the history
…ded-fiat-values

Add rounded fiat value info popup
  • Loading branch information
ManfredKarrer authored Aug 16, 2018
2 parents 45a9019 + e0bd79f commit 63acd56
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/main/java/bisq/desktop/main/offer/MutableOfferView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down
27 changes: 18 additions & 9 deletions src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private BusyAnimation waitingForFundsBusyAnimation, offerAvailabilityBusyAnimation;
private Notification walletFundedNotification;
private OfferView.CloseHandler closeHandler;
private ChangeListener<Boolean> amountFocusedListener;
private Subscription cancelButton2StyleSubscription, balanceSubscription,
showTransactionPublishedScreenSubscription, showWarningInvalidBtcDecimalPlacesSubscription,
isWaitingForFundsSubscription, offerWarningSubscription, errorMessageSubscription,
Expand All @@ -154,7 +153,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private int gridRow = 0;
private boolean offerDetailsWindowDisplayed, clearXchangeWarningDisplayed;
private SimpleBooleanProperty errorPopupDisplayed;
private ChangeListener<Boolean> getShowWalletFundedNotificationListener;
private ChangeListener<Boolean> amountFocusedListener, getShowWalletFundedNotificationListener;
private InfoTextField volumeInfoTextField;

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 63acd56

Please sign in to comment.