From: Damyan Ivanov Date: Thu, 4 Mar 2021 21:22:59 +0000 (+0200) Subject: save a setText() call that would not change anyting X-Git-Tag: v0.17.0~29 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=dea18e5ad48b340d462031a00afff1a35326d522;p=mobile-ledger.git save a setText() call that would not change anyting --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java index 3b69110a..01c3bfdf 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java @@ -124,8 +124,9 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder try { String input = String.valueOf(b.accountRowAccAmounts.getText()); input = input.replace(decimalSeparator, decimalDot); - b.accountRowAccAmounts.setText( - String.format("%4.2f", Float.parseFloat(input))); + final String newText = String.format("%4.2f", Float.parseFloat(input)); + if (!newText.equals(input)) + b.accountRowAccAmounts.setText(newText); } catch (NumberFormatException ex) { // ignored