mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
use wallet unit when displaying pool denomination
This commit is contained in:
parent
712241873f
commit
761e9c9b7e
1 changed files with 12 additions and 2 deletions
|
@ -115,8 +115,18 @@ public class WhirlpoolController {
|
||||||
|
|
||||||
pool.setConverter(new StringConverter<Pool>() {
|
pool.setConverter(new StringConverter<Pool>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString(Pool pool) {
|
public String toString(Pool selectedPool) {
|
||||||
return pool == null ? "Fetching pools..." : pool.getPoolId().replace("btc", " BTC");
|
if(selectedPool == null) {
|
||||||
|
pool.setTooltip(null);
|
||||||
|
return "Fetching pools...";
|
||||||
|
}
|
||||||
|
|
||||||
|
BitcoinUnit bitcoinUnit = wallet.getAutoUnit();
|
||||||
|
String satsValue = String.format(Locale.ENGLISH, "%,d", selectedPool.getDenomination()) + " sats";
|
||||||
|
String btcValue = CoinLabel.BTC_FORMAT.format((double)selectedPool.getDenomination() / Transaction.SATOSHIS_PER_BITCOIN) + " BTC";
|
||||||
|
|
||||||
|
pool.setTooltip(bitcoinUnit == BitcoinUnit.BTC ? new Tooltip(satsValue) : new Tooltip(btcValue));
|
||||||
|
return bitcoinUnit == BitcoinUnit.BTC ? btcValue : satsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue