package net.ktnx.mobileledger.model;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import net.ktnx.mobileledger.db.TransactionAccount;
import net.ktnx.mobileledger.utils.Misc;
private String shortAccountName;
private float amount;
private boolean amountSet = false;
+ @Nullable
private String currency;
private String comment;
private boolean amountValid = true;
return amountSet;
}
public boolean isAmountValid() { return amountValid; }
+ @Nullable
public String getCurrency() {
return currency;
}
int negativeCount = 0;
for (int i = 0; i < accounts.size(); i++) {
LedgerTransactionAccount acc = accounts.get(i);
- TransactionAccount item =
- new TransactionAccount(acc.getAccountName(), acc.getCurrency());
+ TransactionAccount item = new TransactionAccount(acc.getAccountName(),
+ Misc.nullIsEmpty(acc.getCurrency()));
newList.add(item);
item.setAccountName(acc.getAccountName());
private String accountName;
private String amountHint;
private String comment;
+ @NotNull
private String currency = "";
private float amount;
private boolean amountSet;
}
public TransactionAccount(LedgerTransactionAccount account) {
super();
- currency = account.getCurrency();
+ currency = Misc.nullIsEmpty(account.getCurrency());
amount = account.getAmount();
}
public TransactionAccount(String accountName) {
}
@SuppressLint("DefaultLocale")
@Override
+ @NotNull
public String toString() {
StringBuilder b = new StringBuilder();
b.append(String.format("id:%d/%s", id, Integer.toHexString(hashCode())));