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) {
|
||||
String fee = makerFeeAsCoin != null ? btcFormatter.formatCoinWithCode(makerFeeAsCoin) : Res.get("shared.na");
|
||||
String feeInFiatAsString = feeInFiat != null ? btcFormatter.formatVolumeWithCode(feeInFiat) : Res.get("shared.na");
|
||||
public static String getFeeWithFiatAmount(Coin makerFeeAsCoin, Optional<Volume> optionalFeeInFiat, BSFormatter formatter) {
|
||||
String fee = makerFeeAsCoin != null ? formatter.formatCoinWithCode(makerFeeAsCoin) : 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1300,6 +1300,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
|||
// Fixed/Percentage toggle
|
||||
priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL);
|
||||
editOfferElements.add(priceTypeToggleButton);
|
||||
HBox.setMargin(priceTypeToggleButton, new Insets(16, 0, 0, 0));
|
||||
|
||||
priceTypeToggleButton.setOnAction((actionEvent) -> {
|
||||
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));
|
||||
|
||||
VBox vBox = new VBox();
|
||||
vBox.setMaxWidth(243);
|
||||
vBox.getStyleClass().add("input-with-border");
|
||||
vBox.getChildren().addAll(tradeFeeInBtcTextField, tradeFeeInBsqTextField);
|
||||
|
||||
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
||||
|
@ -1340,6 +1343,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
|||
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
|
||||
tradeFeeInBsqToggle.setText("BSQ");
|
||||
tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));
|
||||
//tradeFeeInBsqToggle.setRotate(90);
|
||||
|
||||
VBox tradeFeeToggleButtonBox = new VBox();
|
||||
tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);
|
||||
|
@ -1349,9 +1353,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
|||
tradeFeeDescriptionLabel.setPrefWidth(170);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setMaxWidth(243);
|
||||
hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
|
||||
hBox.getStyleClass().add("input-with-border");
|
||||
hBox.setMinHeight(47);
|
||||
hBox.setMaxHeight(hBox.getMinHeight());
|
||||
HBox.setHgrow(vBox, Priority.ALWAYS);
|
||||
|
|
|
@ -491,23 +491,19 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
private void applyMakerFee() {
|
||||
Coin makerFeeAsCoin = dataModel.getMakerFee();
|
||||
if (makerFeeAsCoin != null) {
|
||||
tradeFee.set(getFormatterForMakerFee().formatCoin(makerFeeAsCoin));
|
||||
|
||||
Coin makerFeeInBtc = dataModel.getMakerFeeInBtc();
|
||||
Optional<Volume> optionalBtcFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBtc,
|
||||
true, preferences, priceFeedService, bsqFormatter);
|
||||
optionalBtcFeeInFiat.ifPresent(feeInFiat -> {
|
||||
String feeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBtc, feeInFiat, btcFormatter);
|
||||
tradeFeeInBtcWithFiat.set(feeWithFiatAmount);
|
||||
});
|
||||
String btcFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBtc, optionalBtcFeeInFiat, btcFormatter);
|
||||
tradeFeeInBtcWithFiat.set(btcFeeWithFiatAmount);
|
||||
|
||||
Coin makerFeeInBsq = dataModel.getMakerFeeInBsq();
|
||||
Optional<Volume> optionalBsqFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBsq,
|
||||
false, preferences, priceFeedService, bsqFormatter);
|
||||
optionalBsqFeeInFiat.ifPresent(feeInFiat -> {
|
||||
String feeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBsq, feeInFiat, bsqFormatter);
|
||||
tradeFeeInBsqWithFiat.set(feeWithFiatAmount);
|
||||
});
|
||||
|
||||
tradeFee.set(getFormatterForMakerFee().formatCoin(makerFeeAsCoin));
|
||||
String bsqFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBsq, optionalBsqFeeInFiat, bsqFormatter);
|
||||
tradeFeeInBsqWithFiat.set(bsqFeeWithFiatAmount);
|
||||
}
|
||||
tradeFeeCurrencyCode.set(dataModel.isCurrencyForMakerFeeBtc() ? Res.getBaseCurrencyCode() : "BSQ");
|
||||
tradeFeeDescription.set(DevEnv.isDaoActivated() ? Res.get("createOffer.tradeFee.descriptionBSQEnabled") :
|
||||
|
|
Loading…
Add table
Reference in a new issue