private final String boldAccountName;
private SimpleDate earliestDate, latestDate;
private SimpleDate lastDate;
- private boolean done;
+ private int transactionCount = 0;
public TransactionAccumulator(String boldAccountName) {
this.boldAccountName = boldAccountName;
put(transaction, transaction.getDate());
}
public void put(LedgerTransaction transaction, SimpleDate date) {
- if (done)
- throw new IllegalStateException("Can't put new items after done()");
+ transactionCount++;
// first item
if (null == latestDate)
lastDate = date;
}
public void publishResults(MainModel model) {
- model.setDisplayedTransactions(list);
+ model.setDisplayedTransactions(list, transactionCount);
model.setFirstTransactionDate(earliestDate);
model.setLastTransactionDate(latestDate);
}
public LiveData<List<TransactionListItem>> getDisplayedTransactions() {
return displayedTransactions;
}
- public void setDisplayedTransactions(List<TransactionListItem> list) {
+ public void setDisplayedTransactions(List<TransactionListItem> list, int transactionCount) {
displayedTransactions.postValue(list);
- Data.lastUpdateTransactionCount.postValue(list.size());
+ Data.lastUpdateTransactionCount.postValue(transactionCount);
}
public SimpleDate getFirstTransactionDate() {
return firstTransactionDate;