]> git.ktnx.net Git - mobile-ledger.git/commitdiff
use Misc.isZero for zero-like comparison
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 10 Nov 2019 17:39:51 +0000 (19:39 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 10 Nov 2019 17:39:51 +0000 (19:39 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java

index 0f46d8aeb4815672d7af952c333e273a51845f37..330b5ac26731be52495d5da9d30ce05787dc6601 100644 (file)
@@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData;
 import androidx.lifecycle.ViewModel;
 
 import net.ktnx.mobileledger.model.LedgerTransactionAccount;
+import net.ktnx.mobileledger.utils.Misc;
 
 import org.jetbrains.annotations.NotNull;
 
@@ -173,7 +174,7 @@ public class NewTransactionModel extends ViewModel {
 
             if (single_empty_amount) {
                 empty_amount.setAmountHint(String.format(Locale.US, "%1.2f",
-                        (Math.abs(running_total) > 0.005) ? -running_total : 0f));
+                        Misc.isZero(running_total) ? 0f : -running_total));
             }
 
             debug("submittable", String.format(Locale.US,