From 959bf91aa8d1e3d304b86b9805e4df60964b6755 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 10 Nov 2019 19:39:51 +0200 Subject: [PATCH] use Misc.isZero for zero-like comparison --- .../net/ktnx/mobileledger/ui/activity/NewTransactionModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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, -- 2.39.5