]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java
TransactionAccumulator needs not keep a reference to the main model
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / TransactionAccumulator.java
index 62b962748b9bab4e3a0deda55e1fe77f2cc34bc9..bdf4b7b1e712c04401a95b7fdc7278183049c659 100644 (file)
 
 package net.ktnx.mobileledger.async;
 
-import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerTransaction;
 import net.ktnx.mobileledger.model.TransactionListItem;
 import net.ktnx.mobileledger.ui.MainModel;
 import net.ktnx.mobileledger.utils.SimpleDate;
 
 import java.util.ArrayList;
-import java.util.Date;
 
 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();
+    public TransactionAccumulator(String boldAccountName) {
+        this.boldAccountName = boldAccountName;
 
         list.add(new TransactionListItem());    // head item
     }
@@ -64,10 +58,8 @@ public class TransactionAccumulator {
 
         lastDate = date;
     }
-    public void done() {
-        done = true;
+    public void publishResults(MainModel model) {
         model.setDisplayedTransactions(list);
-        Data.lastUpdateDate.postValue(new Date());
         model.setFirstTransactionDate(earliestDate);
         model.setLastTransactionDate(latestDate);
     }