Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rounded fiat value info popup #1629

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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