From adf69118b53d51145ad6cd59ffe9a654f1305662 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 30 Jan 2021 16:36:23 +0200 Subject: [PATCH] format account amounts upon focus leave; store in DB --- .../ui/patterns/PatternDetailsAdapter.java | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java index e98a28f7..25083fac 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java @@ -42,6 +42,7 @@ import net.ktnx.mobileledger.utils.Misc; import org.jetbrains.annotations.NotNull; +import java.text.ParseException; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -454,6 +455,53 @@ class PatternDetailsAdapter extends RecyclerView.Adapter { + if (hasFocus) + return; + + PatternDetailsItem.AccountRow accRow = getItem(); + if (!accRow.hasLiteralAmount()) + return; + Float amt = accRow.getAmount(); + if (amt == null) + return; + + b.patternDetailsAccountAmount.setText(Data.formatNumber(amt)); + }); } @Override void bind(PatternDetailsItem item) { @@ -488,7 +536,9 @@ class PatternDetailsAdapter extends RecyclerView.Adapter