mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-17 00:07:49 +00:00
show progress percent while taking offer
This commit is contained in:
parent
9d87e30da0
commit
19d83749eb
2 changed files with 6 additions and 3 deletions
|
@ -188,7 +188,6 @@ public class HavenoUtils {
|
|||
try {
|
||||
return xmrToAtomicUnits(new BigDecimal(input).doubleValue());
|
||||
} catch (Exception e) {
|
||||
log.warn("Exception at parseXmr: " + e.toString());
|
||||
return BigInteger.valueOf(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
placeOfferHandlerOptional.ifPresent(Runnable::run);
|
||||
} else {
|
||||
State lastState = Trade.State.ARBITRATOR_PUBLISHED_DEPOSIT_TXS;
|
||||
spinnerInfoLabel.setText(Res.get("takeOffer.fundsBox.takeOfferSpinnerInfo") + " 1/" + (lastState.ordinal() + 1));
|
||||
spinnerInfoLabel.setText(Res.get("takeOffer.fundsBox.takeOfferSpinnerInfo") + " " + getPercentString(0, lastState.ordinal()));
|
||||
takeOfferHandlerOptional.ifPresent(Runnable::run);
|
||||
|
||||
// update trade state progress
|
||||
|
@ -415,7 +415,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
Trade trade = tradeManager.getTrade(offer.getId());
|
||||
if (trade == null) return;
|
||||
tradeStateSubscription = EasyBind.subscribe(trade.stateProperty(), newState -> {
|
||||
String progress = (newState.ordinal() + 1) + "/" + (lastState.ordinal() + 1);
|
||||
String progress = getPercentString(newState.ordinal(), lastState.ordinal());
|
||||
spinnerInfoLabel.setText(Res.get("takeOffer.fundsBox.takeOfferSpinnerInfo") + " " + progress);
|
||||
|
||||
// unsubscribe when done
|
||||
|
@ -429,4 +429,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String getPercentString(int newOrdinal, int lastOrdinal) {
|
||||
return (int) ((double) newOrdinal / (double) lastOrdinal * 100) + "%";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue