mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Move fee toggle outside of box
This commit is contained in:
parent
5ac35284ef
commit
b5568b8f1c
3 changed files with 18 additions and 15 deletions
|
@ -295,9 +295,14 @@ public class OfferUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFeeWithFiatAmount(Coin makerFeeAsCoin, Volume feeInFiat, BSFormatter btcFormatter) {
|
public static String getFeeWithFiatAmount(Coin makerFeeAsCoin, Optional<Volume> optionalFeeInFiat, BSFormatter formatter) {
|
||||||
String fee = makerFeeAsCoin != null ? btcFormatter.formatCoinWithCode(makerFeeAsCoin) : Res.get("shared.na");
|
String fee = makerFeeAsCoin != null ? formatter.formatCoinWithCode(makerFeeAsCoin) : Res.get("shared.na");
|
||||||
String feeInFiatAsString = feeInFiat != null ? btcFormatter.formatVolumeWithCode(feeInFiat) : Res.get("shared.na");
|
String feeInFiatAsString;
|
||||||
|
if (optionalFeeInFiat != null && optionalFeeInFiat.isPresent()) {
|
||||||
|
feeInFiatAsString = formatter.formatVolumeWithCode(optionalFeeInFiat.get());
|
||||||
|
} else {
|
||||||
|
feeInFiatAsString = Res.get("shared.na");
|
||||||
|
}
|
||||||
return Res.get("feeOptionWindow.fee", fee, feeInFiatAsString);
|
return Res.get("feeOptionWindow.fee", fee, feeInFiatAsString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1300,6 +1300,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||||
// Fixed/Percentage toggle
|
// Fixed/Percentage toggle
|
||||||
priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL);
|
priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL);
|
||||||
editOfferElements.add(priceTypeToggleButton);
|
editOfferElements.add(priceTypeToggleButton);
|
||||||
|
HBox.setMargin(priceTypeToggleButton, new Insets(16, 0, 0, 0));
|
||||||
|
|
||||||
priceTypeToggleButton.setOnAction((actionEvent) -> {
|
priceTypeToggleButton.setOnAction((actionEvent) -> {
|
||||||
updatePriceToggleButtons(model.getDataModel().getUseMarketBasedPrice().getValue());
|
updatePriceToggleButtons(model.getDataModel().getUseMarketBasedPrice().getValue());
|
||||||
|
@ -1331,6 +1332,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||||
tradeFeeInBsqTextField.setPadding(new Insets(-9, 5, -7, 0));
|
tradeFeeInBsqTextField.setPadding(new Insets(-9, 5, -7, 0));
|
||||||
|
|
||||||
VBox vBox = new VBox();
|
VBox vBox = new VBox();
|
||||||
|
vBox.setMaxWidth(243);
|
||||||
|
vBox.getStyleClass().add("input-with-border");
|
||||||
vBox.getChildren().addAll(tradeFeeInBtcTextField, tradeFeeInBsqTextField);
|
vBox.getChildren().addAll(tradeFeeInBtcTextField, tradeFeeInBsqTextField);
|
||||||
|
|
||||||
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
||||||
|
@ -1340,6 +1343,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||||
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
|
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
|
||||||
tradeFeeInBsqToggle.setText("BSQ");
|
tradeFeeInBsqToggle.setText("BSQ");
|
||||||
tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));
|
tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));
|
||||||
|
//tradeFeeInBsqToggle.setRotate(90);
|
||||||
|
|
||||||
VBox tradeFeeToggleButtonBox = new VBox();
|
VBox tradeFeeToggleButtonBox = new VBox();
|
||||||
tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);
|
tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);
|
||||||
|
@ -1349,9 +1353,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||||
tradeFeeDescriptionLabel.setPrefWidth(170);
|
tradeFeeDescriptionLabel.setPrefWidth(170);
|
||||||
|
|
||||||
HBox hBox = new HBox();
|
HBox hBox = new HBox();
|
||||||
hBox.setMaxWidth(243);
|
|
||||||
hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
|
hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
|
||||||
hBox.getStyleClass().add("input-with-border");
|
|
||||||
hBox.setMinHeight(47);
|
hBox.setMinHeight(47);
|
||||||
hBox.setMaxHeight(hBox.getMinHeight());
|
hBox.setMaxHeight(hBox.getMinHeight());
|
||||||
HBox.setHgrow(vBox, Priority.ALWAYS);
|
HBox.setHgrow(vBox, Priority.ALWAYS);
|
||||||
|
|
|
@ -491,23 +491,19 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||||
private void applyMakerFee() {
|
private void applyMakerFee() {
|
||||||
Coin makerFeeAsCoin = dataModel.getMakerFee();
|
Coin makerFeeAsCoin = dataModel.getMakerFee();
|
||||||
if (makerFeeAsCoin != null) {
|
if (makerFeeAsCoin != null) {
|
||||||
|
tradeFee.set(getFormatterForMakerFee().formatCoin(makerFeeAsCoin));
|
||||||
|
|
||||||
Coin makerFeeInBtc = dataModel.getMakerFeeInBtc();
|
Coin makerFeeInBtc = dataModel.getMakerFeeInBtc();
|
||||||
Optional<Volume> optionalBtcFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBtc,
|
Optional<Volume> optionalBtcFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBtc,
|
||||||
true, preferences, priceFeedService, bsqFormatter);
|
true, preferences, priceFeedService, bsqFormatter);
|
||||||
optionalBtcFeeInFiat.ifPresent(feeInFiat -> {
|
String btcFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBtc, optionalBtcFeeInFiat, btcFormatter);
|
||||||
String feeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBtc, feeInFiat, btcFormatter);
|
tradeFeeInBtcWithFiat.set(btcFeeWithFiatAmount);
|
||||||
tradeFeeInBtcWithFiat.set(feeWithFiatAmount);
|
|
||||||
});
|
|
||||||
|
|
||||||
Coin makerFeeInBsq = dataModel.getMakerFeeInBsq();
|
Coin makerFeeInBsq = dataModel.getMakerFeeInBsq();
|
||||||
Optional<Volume> optionalBsqFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBsq,
|
Optional<Volume> optionalBsqFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBsq,
|
||||||
false, preferences, priceFeedService, bsqFormatter);
|
false, preferences, priceFeedService, bsqFormatter);
|
||||||
optionalBsqFeeInFiat.ifPresent(feeInFiat -> {
|
String bsqFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBsq, optionalBsqFeeInFiat, bsqFormatter);
|
||||||
String feeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBsq, feeInFiat, bsqFormatter);
|
tradeFeeInBsqWithFiat.set(bsqFeeWithFiatAmount);
|
||||||
tradeFeeInBsqWithFiat.set(feeWithFiatAmount);
|
|
||||||
});
|
|
||||||
|
|
||||||
tradeFee.set(getFormatterForMakerFee().formatCoin(makerFeeAsCoin));
|
|
||||||
}
|
}
|
||||||
tradeFeeCurrencyCode.set(dataModel.isCurrencyForMakerFeeBtc() ? Res.getBaseCurrencyCode() : "BSQ");
|
tradeFeeCurrencyCode.set(dataModel.isCurrencyForMakerFeeBtc() ? Res.getBaseCurrencyCode() : "BSQ");
|
||||||
tradeFeeDescription.set(DevEnv.isDaoActivated() ? Res.get("createOffer.tradeFee.descriptionBSQEnabled") :
|
tradeFeeDescription.set(DevEnv.isDaoActivated() ? Res.get("createOffer.tradeFee.descriptionBSQEnabled") :
|
||||||
|
|
Loading…
Add table
Reference in a new issue