From: Damyan Ivanov Date: Mon, 8 Feb 2021 05:50:38 +0000 (+0000) Subject: AccountRow.isEmpty(): is this a disposable empty row? X-Git-Tag: v0.17.0~103 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=c730da219fa2fdbf803faaa29538a6d62436a374;p=mobile-ledger.git AccountRow.isEmpty(): is this a disposable empty row? i.e., without account name/comment/amount source/value --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java b/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java index f158f413..03451c90 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java @@ -278,6 +278,12 @@ abstract public class TemplateDetailsItem { return "grp:" + matchGroup; return ""; } + public boolean isEmpty() { + if (literalValue) + return value == null || Misc.emptyIsNull(value.toString()) == null; + + return matchGroup > 0; + } } public static class TYPE { @@ -421,6 +427,9 @@ abstract public class TemplateDetailsItem { return result; } + public boolean isEmpty() { + return accountName.isEmpty() && accountComment.isEmpty() && amount.isEmpty(); + } } public static class Header extends TemplateDetailsItem {