]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/MainModel.java
TransactionAccumulator needs not keep a reference to the main model
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / MainModel.java
index 039e24df6c45ed9495b09056efad4661debee203..a620255dff7fcea330ce35dffe43e0f2c21ada52 100644 (file)
@@ -133,7 +133,7 @@ public class MainModel extends ViewModel {
             String accNameFilter = model.getAccountFilter()
                                         .getValue();
 
-            TransactionAccumulator acc = new TransactionAccumulator(model);
+            TransactionAccumulator acc = new TransactionAccumulator(accNameFilter);
             for (LedgerTransaction tr : list) {
                 if (isInterrupted()) {
                     return;
@@ -143,10 +143,12 @@ public class MainModel extends ViewModel {
                     acc.put(tr, tr.getDate());
                 }
             }
-            if (!isInterrupted()) {
-                acc.done();
-            }
-            Logger.debug("dFilter", "left synchronized block");
+
+            if (isInterrupted())
+                return;
+
+            acc.publishResults(model);
+            Logger.debug("dFilter", "transaction list updated");
         }
     }
 }