]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java
rework transaction list with proper view holders and no background load
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / TransactionAccumulator.java
index 89fa2edd19d84b6c4f7e318980e6bde1a7739903..46b8426abbae7aaf1b16b91fd975ed87af52640b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -27,14 +27,21 @@ import java.util.ArrayList;
 public class TransactionAccumulator {
     private final ArrayList<TransactionListItem> list = new ArrayList<>();
     private final MainModel model;
+    private final String boldAccountName;
     private SimpleDate earliestDate, latestDate;
     private SimpleDate lastDate;
     private boolean done;
     public TransactionAccumulator(MainModel model) {
         this.model = model;
 
+        boldAccountName = model.getAccountFilter()
+                               .getValue();
+
         list.add(new TransactionListItem());    // head item
     }
+    public void put(LedgerTransaction transaction) {
+        put(transaction, transaction.getDate());
+    }
     public void put(LedgerTransaction transaction, SimpleDate date) {
         if (done)
             throw new IllegalStateException("Can't put new items after done()");
@@ -51,7 +58,7 @@ public class TransactionAccumulator {
             list.add(new TransactionListItem(date, showMonth));
         }
 
-        list.add(new TransactionListItem(transaction));
+        list.add(new TransactionListItem(transaction, boldAccountName));
 
         lastDate = date;
     }