diff --git a/desktop/src/main/java/bisq/desktop/components/InfoInputTextField.java b/desktop/src/main/java/bisq/desktop/components/InfoInputTextField.java index 15531f9015c..190e3f80c63 100644 --- a/desktop/src/main/java/bisq/desktop/components/InfoInputTextField.java +++ b/desktop/src/main/java/bisq/desktop/components/InfoInputTextField.java @@ -115,6 +115,11 @@ public void setContentForPrivacyPopOver(Node node) { setActionHandlers(node); } + public void hideInfoContent() { + currentIcon = null; + hideIcons(); + } + public void setIconsRightAligned() { AnchorPane.clearConstraints(infoIcon); AnchorPane.clearConstraints(warningIcon); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 444889db984..94919fe1541 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -763,6 +763,8 @@ private void createListeners() { volumeListener = (observable, oldValue, newValue) -> { if (!newValue.equals("") && CurrencyUtil.isFiatCurrency(model.tradeCurrencyCode.get())) { volumeInfoInputTextField.setContentForPrivacyPopOver(createPopoverLabel(Res.get("offerbook.info.roundedFiatVolume"))); + } else { + volumeInfoInputTextField.hideInfoContent(); } }; diff --git a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java index 601435d8d6c..c059249cc28 100644 --- a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java +++ b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java @@ -32,7 +32,7 @@ @Slf4j public class DisplayUtils { private final static int scale = 3; - private static final MonetaryFormat fiatVolumeFormat = new MonetaryFormat().shift(0).minDecimals(2).repeatOptionalDecimals(0, 0); + private static final MonetaryFormat fiatVolumeFormat = new MonetaryFormat().shift(0).minDecimals(0).repeatOptionalDecimals(0, 0); public static String formatDateTime(Date date) { return FormattingUtils.formatDateTime(date, true); diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index 00c8f7783fe..1ea328807af 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -121,11 +121,11 @@ public void testMaxCharactersForFiatBuyVolume() { final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null); model.activate(); - assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01 + assertEquals(1, model.maxPlacesForBuyVolume.intValue()); //0 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); - assertEquals(5, model.maxPlacesForBuyVolume.intValue()); //10.00 + assertEquals(2, model.maxPlacesForBuyVolume.intValue()); //10 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); - assertEquals(7, model.maxPlacesForBuyVolume.intValue()); //2212.86 + assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //2213 } @Test @@ -199,10 +199,10 @@ public void testMaxCharactersForFiatSellVolume() { final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null); model.activate(); - assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01 + assertEquals(1, model.maxPlacesForSellVolume.intValue()); //0 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); - assertEquals(5, model.maxPlacesForSellVolume.intValue()); //10.00 + assertEquals(2, model.maxPlacesForSellVolume.intValue()); //10 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); - assertEquals(7, model.maxPlacesForSellVolume.intValue()); //2212.86 + assertEquals(4, model.maxPlacesForSellVolume.intValue()); //2213 } } diff --git a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java index bb6b7d81820..3b76f7e2742 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java @@ -298,9 +298,9 @@ public void testMaxCharactersForVolume() { null, null, null, null, coinFormatter, new BsqFormatter()); model.activate(); - assertEquals(8, model.maxPlacesForVolume.intValue()); + assertEquals(5, model.maxPlacesForVolume.intValue()); offerBookListItems.addAll(make(btcBuyItem.but(with(amount, 2000000000L)))); - assertEquals(10, model.maxPlacesForVolume.intValue()); + assertEquals(7, model.maxPlacesForVolume.intValue()); } @Test @@ -316,12 +316,12 @@ public void testMaxCharactersForVolumeRange() { null, null, null, null, coinFormatter, new BsqFormatter()); model.activate(); - assertEquals(15, model.maxPlacesForVolume.intValue()); + assertEquals(9, model.maxPlacesForVolume.intValue()); offerBookListItems.addAll(make(btcItemWithRange.but(with(amount, 2000000000L)))); - assertEquals(17, model.maxPlacesForVolume.intValue()); + assertEquals(11, model.maxPlacesForVolume.intValue()); offerBookListItems.addAll(make(btcItemWithRange.but(with(minAmount, 30000000000L), with(amount, 30000000000L)))); - assertEquals(25, model.maxPlacesForVolume.intValue()); + assertEquals(19, model.maxPlacesForVolume.intValue()); } @Test diff --git a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java index e36741a4dd2..632b49b82a0 100644 --- a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java +++ b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java @@ -49,9 +49,9 @@ public void testFormatAccountAge() { @Test public void testFormatVolume() { - assertEquals("1.00", DisplayUtils.formatVolume(make(btcUsdOffer), true, 4)); - assertEquals("100.00", DisplayUtils.formatVolume(make(usdVolume))); - assertEquals("1774.62", DisplayUtils.formatVolume(make(usdVolume.but(with(volumeString, "1774.62"))))); + assertEquals("1", DisplayUtils.formatVolume(make(btcUsdOffer), true, 4)); + assertEquals("100", DisplayUtils.formatVolume(make(usdVolume))); + assertEquals("1775", DisplayUtils.formatVolume(make(usdVolume.but(with(volumeString, "1774.62"))))); } @Test