]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
update the in-memory account list after parsing the JSON account list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / RetrieveTransactionsTask.java
index 965c1f982fc98db94458dfb1109d9e4eabd07c67..dcc91b2f27ff2a7cb2aa5433afee4970741522df 100644 (file)
@@ -372,6 +372,7 @@ public class RetrieveTransactionsTask
                     profile.markAccountsAsNotPresent(db);
 
                     AccountListParser parser = new AccountListParser(resp);
+                    ArrayList<LedgerAccount> accountList = new ArrayList<>();
 
                     while (true) {
                         throwIfCancelled();
@@ -384,12 +385,15 @@ public class RetrieveTransactionsTask
                             profile.storeAccountValue(acc.getName(), b.getAcommodity(),
                                     b.getAquantity().asFloat());
                         }
+
+                        accountList.add(acc);
                     }
                     throwIfCancelled();
 
                     profile.deleteNotPresentAccounts(db);
                     throwIfCancelled();
                     db.setTransactionSuccessful();
+                    Data.accounts.set(accountList);
                 }
                 finally {
                     db.endTransaction();