- syncData();
- Logger.debug("textWatcher",
- "syncData() returned, checking if transaction is submittable");
- adapter.model.checkTransactionSubmittable(null);
+ if (syncData()) {
+ Logger.debug("textWatcher",
+ "syncData() returned, checking if transaction is submittable");
+ adapter.model.checkTransactionSubmittable(null);
+ }
try {
if (item instanceof NewTransactionModel.TransactionHead) {
NewTransactionModel.TransactionHead head = item.toTransactionHead();
head.setDate(String.valueOf(b.newTransactionDate.getText()));
try {
if (item instanceof NewTransactionModel.TransactionHead) {
NewTransactionModel.TransactionHead head = item.toTransactionHead();
head.setDate(String.valueOf(b.newTransactionDate.getText()));
head.setDescription(String.valueOf(b.newTransactionDescription.getText()));
head.setComment(String.valueOf(b.transactionComment.getText()));
}
else if (item instanceof NewTransactionModel.TransactionAccount) {
NewTransactionModel.TransactionAccount acc = item.toTransactionAccount();
head.setDescription(String.valueOf(b.newTransactionDescription.getText()));
head.setComment(String.valueOf(b.transactionComment.getText()));
}
else if (item instanceof NewTransactionModel.TransactionAccount) {
NewTransactionModel.TransactionAccount acc = item.toTransactionAccount();
acc.setAccountName(String.valueOf(b.accountRowAccName.getText()));
acc.setComment(String.valueOf(b.comment.getText()));
acc.setAccountName(String.valueOf(b.accountRowAccName.getText()));
acc.setComment(String.valueOf(b.comment.getText()));
acc.resetAmount();
acc.setAmountValid(true);
}
else {
try {
amount = amount.replace(decimalSeparator, decimalDot);
acc.resetAmount();
acc.setAmountValid(true);
}
else {
try {
amount = amount.replace(decimalSeparator, decimalDot);
- acc.setAmount(Float.parseFloat(amount));
+ final float parsedAmount = Float.parseFloat(amount);
+ if (!acc.isAmountSet() || !Misc.equalFloats(parsedAmount, acc.getAmount()))
+ significantChange = true;
+ acc.setAmount(parsedAmount);
acc.setAmountValid(true);
}
catch (NumberFormatException e) {
Logger.debug("new-trans", String.format(
"assuming amount is not set due to number format exception. " +
"input was '%s'", amount));
acc.setAmountValid(true);
}
catch (NumberFormatException e) {
Logger.debug("new-trans", String.format(
"assuming amount is not set due to number format exception. " +
"input was '%s'", amount));
}
catch (ParseException e) {
throw new RuntimeException("Should not happen", e);
}
catch (ParseException e) {
throw new RuntimeException("Should not happen", e);