mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Adapt amount and volume description for create offer
This commit is contained in:
parent
492ff35b09
commit
63ea054026
@ -454,6 +454,8 @@ createOffer.amount.prompt=Enter amount in BTC
|
||||
createOffer.price.prompt=Enter price
|
||||
createOffer.volume.prompt=Enter amount in {0}
|
||||
createOffer.amountPriceBox.amountDescription=Amount of BTC to {0}
|
||||
createOffer.amountPriceBox.buy.amountDescriptionAltcoin=Amount in BTC to spend
|
||||
createOffer.amountPriceBox.sell.amountDescriptionAltcoin=Amount in BTC to receive
|
||||
createOffer.amountPriceBox.buy.volumeDescription=Amount in {0} to spend
|
||||
createOffer.amountPriceBox.sell.volumeDescription=Amount in {0} to receive
|
||||
createOffer.amountPriceBox.buy.volumeDescriptionAltcoin=Amount in {0} to sell
|
||||
|
@ -340,7 +340,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||
} else {
|
||||
placeOfferButtonLabel = Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.buy"), tradeCurrency.getCode());
|
||||
}
|
||||
placeOfferButton.updateText(placeOfferButtonLabel);
|
||||
nextButton.setId("buy-button");
|
||||
fundFromSavingsWalletButton.setId("buy-button");
|
||||
} else {
|
||||
@ -354,7 +353,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||
fundFromSavingsWalletButton.setId("sell-button");
|
||||
}
|
||||
|
||||
|
||||
placeOfferButton.updateText(placeOfferButtonLabel);
|
||||
updatePriceToggle();
|
||||
|
||||
if (!model.getDataModel().isMakerFeeValid() && model.getDataModel().getMakerFee() != null)
|
||||
|
@ -269,11 +269,15 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
private void addBindings() {
|
||||
if (dataModel.getDirection() == OfferDirection.BUY) {
|
||||
volumeDescriptionLabel.bind(createStringBinding(
|
||||
() -> Res.get("createOffer.amountPriceBox.buy.volumeDescription", dataModel.getTradeCurrencyCode().get()),
|
||||
dataModel.getTradeCurrencyCode()));
|
||||
() -> Res.get(CurrencyUtil.isFiatCurrency(dataModel.getTradeCurrencyCode().get()) ?
|
||||
"createOffer.amountPriceBox.buy.volumeDescription" :
|
||||
"createOffer.amountPriceBox.buy.volumeDescriptionAltcoin", dataModel.getTradeCurrencyCode().get(),
|
||||
dataModel.getTradeCurrencyCode())));
|
||||
} else {
|
||||
volumeDescriptionLabel.bind(createStringBinding(
|
||||
() -> Res.get("createOffer.amountPriceBox.sell.volumeDescription", dataModel.getTradeCurrencyCode().get()),
|
||||
() -> Res.get(CurrencyUtil.isFiatCurrency(dataModel.getTradeCurrencyCode().get()) ?
|
||||
"createOffer.amountPriceBox.sell.volumeDescription" :
|
||||
"createOffer.amountPriceBox.sell.volumeDescriptionAltcoin", dataModel.getTradeCurrencyCode().get()),
|
||||
dataModel.getTradeCurrencyCode()));
|
||||
}
|
||||
volumePromptLabel.bind(createStringBinding(
|
||||
@ -590,8 +594,16 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
btcValidator.setMinValue(Restrictions.getMinTradeAmount());
|
||||
|
||||
final boolean isBuy = dataModel.getDirection() == OfferDirection.BUY;
|
||||
amountDescription = Res.get("createOffer.amountPriceBox.amountDescription",
|
||||
isBuy ? Res.get("shared.buy") : Res.get("shared.sell"));
|
||||
|
||||
boolean isFiatCurrency = CurrencyUtil.isFiatCurrency(tradeCurrency.getCode());
|
||||
|
||||
if (isFiatCurrency) {
|
||||
amountDescription = Res.get("createOffer.amountPriceBox.amountDescription",
|
||||
isBuy ? Res.get("shared.buy") : Res.get("shared.sell"));
|
||||
} else {
|
||||
amountDescription = Res.get(isBuy ? "createOffer.amountPriceBox.sell.amountDescriptionAltcoin" :
|
||||
"createOffer.amountPriceBox.buy.amountDescriptionAltcoin");
|
||||
}
|
||||
|
||||
securityDepositValidator.setPaymentAccount(dataModel.paymentAccount);
|
||||
validateAndSetBuyerSecurityDepositToModel();
|
||||
|
@ -167,6 +167,17 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
addBindings();
|
||||
addListeners();
|
||||
|
||||
String buyVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.buy.volumeDescription" :
|
||||
"createOffer.amountPriceBox.buy.volumeDescriptionAltcoin";
|
||||
String sellVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.sell.volumeDescription" :
|
||||
"createOffer.amountPriceBox.sell.volumeDescriptionAltcoin";
|
||||
|
||||
if (dataModel.getDirection() == OfferDirection.SELL) {
|
||||
volumeDescriptionLabel.set(Res.get(buyVolumeDescriptionKey, dataModel.getCurrencyCode()));
|
||||
} else {
|
||||
volumeDescriptionLabel.set(Res.get(sellVolumeDescriptionKey, dataModel.getCurrencyCode()));
|
||||
}
|
||||
|
||||
amount.set(btcFormatter.formatCoin(dataModel.getAmount().get()));
|
||||
showTransactionPublishedScreen.set(false);
|
||||
|
||||
@ -482,17 +493,6 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
|
||||
private void addBindings() {
|
||||
volume.bind(createStringBinding(() -> VolumeUtil.formatVolume(dataModel.volume.get()), dataModel.volume));
|
||||
|
||||
String buyVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.buy.volumeDescription" :
|
||||
"createOffer.amountPriceBox.buy.volumeDescriptionAltcoin";
|
||||
String sellVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.sell.volumeDescription" :
|
||||
"createOffer.amountPriceBox.sell.volumeDescriptionAltcoin";
|
||||
|
||||
if (dataModel.getDirection() == OfferDirection.SELL) {
|
||||
volumeDescriptionLabel.set(Res.get(buyVolumeDescriptionKey, dataModel.getCurrencyCode()));
|
||||
} else {
|
||||
volumeDescriptionLabel.set(Res.get(sellVolumeDescriptionKey, dataModel.getCurrencyCode()));
|
||||
}
|
||||
totalToPay.bind(createStringBinding(() -> btcFormatter.formatCoinWithCode(dataModel.getTotalToPayAsCoin().get()), dataModel.getTotalToPayAsCoin()));
|
||||
}
|
||||
|
||||
|
@ -179,20 +179,15 @@ public class BsqSwapCreateOfferView extends BsqSwapOfferView<BsqSwapCreateOfferV
|
||||
actionButton.setId("buy-button-big");
|
||||
actionButton.updateText(Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.buy"), BSQ));
|
||||
nextButton.setId("buy-button");
|
||||
volumeDescriptionLabel.setText(Res.get("createOffer.amountPriceBox.sell.volumeDescription", BSQ));
|
||||
amountDescriptionLabel.setText(Res.get("takeOffer.amountPriceBox.buy.amountDescription"));
|
||||
volumeDescriptionLabel.setText(Res.get("createOffer.amountPriceBox.sell.volumeDescriptionAltcoin", BSQ));
|
||||
amountDescriptionLabel.setText(Res.get("takeOffer.amountPriceBox.buy.amountDescriptionAltcoin"));
|
||||
} else {
|
||||
actionButton.setId("sell-button-big");
|
||||
actionButton.updateText(Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.sell"), BSQ));
|
||||
nextButton.setId("sell-button");
|
||||
volumeDescriptionLabel.setText(Res.get("createOffer.amountPriceBox.buy.volumeDescription", BSQ));
|
||||
amountDescriptionLabel.setText(Res.get("takeOffer.amountPriceBox.sell.amountDescription"));
|
||||
volumeDescriptionLabel.setText(Res.get("createOffer.amountPriceBox.buy.volumeDescriptionAltcoin", BSQ));
|
||||
amountDescriptionLabel.setText(Res.get("takeOffer.amountPriceBox.sell.amountDescriptionAltcoin"));
|
||||
}
|
||||
|
||||
String amountDescription = Res.get("createOffer.amountPriceBox.amountDescription",
|
||||
model.dataModel.isBuyOffer() ? Res.get("shared.buy") : Res.get("shared.sell"));
|
||||
amountDescriptionLabel.setText(amountDescription);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user