From 6c03c4106ae612c0b80370c3ed5495b1ba9225bc Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 29 Oct 2021 14:33:15 +0200 Subject: [PATCH] respect wallet labels when displaying name --- .../com/sparrowwallet/drongo/wallet/Wallet.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java index 596bf1b..4703745 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java @@ -69,18 +69,27 @@ public class Wallet extends Persistable implements Comparable { public String getFullName() { if(isMasterWallet()) { - return name; + return childWallets.isEmpty() ? name : name + "-" + (label != null && !label.isEmpty() ? label : getAutomaticName()); } - return getMasterWallet().getName() + "-" + name; + return getMasterWallet().getName() + "-" + getDisplayName(this); } public String getFullDisplayName() { if(isMasterWallet()) { - return name; + return childWallets.isEmpty() ? name : name + " - " + (label != null && !label.isEmpty() ? label : getAutomaticName()); } - return getMasterWallet().getName() + " - " + name; + return getMasterWallet().getName() + " - " + getDisplayName(this); + } + + private String getDisplayName(Wallet wallet) { + return wallet.label != null && !wallet.label.isEmpty() ? wallet.label : wallet.name; + } + + public String getAutomaticName() { + int account = getAccountIndex(); + return (account < 0 || account > 9) ? getName() : (!isWhirlpoolMasterWallet() || account > 1 ? "Account #" + account : "Deposit"); } public String getMasterName() {