show progress percent while taking offer
This commit is contained in:
parent
9d87e30da0
commit
19d83749eb
@ -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 New Issue
Block a user