From: Damyan Ivanov Date: Sun, 10 Nov 2019 17:39:51 +0000 (+0200) Subject: use Misc.isZero for zero-like comparison X-Git-Tag: v0.11.0~87 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=959bf91aa8d1e3d304b86b9805e4df60964b6755;p=mobile-ledger.git use Misc.isZero for zero-like comparison --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java index 0f46d8ae..330b5ac2 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java @@ -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,