X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fnew_transaction%2FNewTransactionModel.java;h=da09fd89a3818dcb9835bf3f96643b792d891d98;hp=a4fe14d2a0c65216e6fec6033bf58e73c0800327;hb=fe3fa7bc5c24b2f96c053861e50665e7393b5c9b;hpb=ac1a592ecbdf1557e2455976aa045de7d6b15b03 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java index a4fe14d2..da09fd89 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java @@ -612,7 +612,11 @@ public class NewTransactionModel extends ViewModel { String.format("Resetting hint of '%s' [%s]", Misc.nullIsEmpty(acc.getAccountName()), balCurrency)); - if (acc.amountHintIsSet && !TextUtils.isEmpty(acc.getAmountHint())) { + // skip if the amount is set, in which case the hint is not + // important/visible + if (!acc.isAmountSet() && acc.amountHintIsSet && + !TextUtils.isEmpty(acc.getAmountHint())) + { if (workingWithLiveList && !liveListCopied) { list = copyList(list); liveListCopied = true; @@ -1155,14 +1159,17 @@ public class NewTransactionModel extends ViewModel { if (other == null) return false; - boolean equal = TextUtils.equals(accountName, other.accountName) && - TextUtils.equals(comment, other.comment) && - (amountSet ? other.amountSet && amount == other.amount - : !other.amountSet) && - (amountHintIsSet ? other.amountHintIsSet && - TextUtils.equals(amountHint, other.amountHint) - : !other.amountHintIsSet) && - TextUtils.equals(currency, other.currency) && isLast == other.isLast; + boolean equal = TextUtils.equals(accountName, other.accountName); + equal = equal && TextUtils.equals(comment, other.comment) && + (amountSet ? other.amountSet && amount == other.amount : !other.amountSet); + + // compare amount hint only if there is no amount + if (!amountSet) + equal = equal && (amountHintIsSet ? other.amountHintIsSet && + TextUtils.equals(amountHint, other.amountHint) + : !other.amountHintIsSet); + equal = equal && TextUtils.equals(currency, other.currency) && isLast == other.isLast; + Logger.debug("new-trans", String.format("Comparing {%s} and {%s}: %s", this.toString(), other.toString(), equal));