]> git.ktnx.net Git - mobile-ledger.git/commitdiff
AccountRow.isEmpty(): is this a disposable empty row?
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 8 Feb 2021 05:50:38 +0000 (05:50 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Feb 2021 07:34:47 +0000 (07:34 +0000)
i.e., without account name/comment/amount source/value

app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java

index f158f413196dace141b2f9f6cdb6f1e9cb1d92fe..03451c90e8da318f538b8324afca74888526d1dd 100644 (file)
@@ -278,6 +278,12 @@ abstract public class TemplateDetailsItem {
                 return "grp:" + matchGroup;
             return "<null>";
         }
+        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 {