X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fasync%2FRetrieveTransactionsTask.java;h=86d4cc457f0155322808d720eb57074c5cdefce8;hb=d08ab8235d0fd152c772b2dd5ffa1ca5747f67b1;hp=1f4ee97238debc8b1b1be6a1921d93ff0f07579f;hpb=29fa90b17cbb87f0b16f3607f0628fe0057d6560;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 1f4ee972..86d4cc45 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -206,7 +206,7 @@ public class RetrieveTransactionsTask // state of the database db.setTransactionSuccessful(); db.endTransaction(); - Data.accounts.setList(accountList); + profile.setAccounts(accountList); db.beginTransaction(); continue; } @@ -220,7 +220,7 @@ public class RetrieveTransactionsTask prevAccount = lastAccount; lastAccount = profile.tryLoadAccount(db, acct_name); if (lastAccount == null) - lastAccount = new LedgerAccount(acct_name); + lastAccount = new LedgerAccount(profile, acct_name); else lastAccount.removeAmounts(); profile.storeAccount(db, lastAccount); @@ -240,14 +240,14 @@ public class RetrieveTransactionsTask if (accountNames.containsKey(parentName)) break; toAppend.push(parentName); - parentName = new LedgerAccount(parentName).getParentName(); + parentName = new LedgerAccount(profile, parentName).getParentName(); } syntheticAccounts.clear(); while (!toAppend.isEmpty()) { String aName = toAppend.pop(); LedgerAccount acc = profile.tryLoadAccount(db, aName); if (acc == null) { - acc = new LedgerAccount(aName); + acc = new LedgerAccount(profile, aName); acc.setExpanded(!lastAccount.hasSubAccounts() || lastAccount.isExpanded()); } @@ -483,7 +483,7 @@ public class RetrieveTransactionsTask LedgerAccount acc = profile.tryLoadAccount(db, parsedAccount.getAname()); if (acc == null) - acc = new LedgerAccount(parsedAccount.getAname()); + acc = new LedgerAccount(profile, parsedAccount.getAname()); else acc.removeAmounts(); @@ -527,16 +527,13 @@ public class RetrieveTransactionsTask profile.deleteNotPresentAccounts(db); throwIfCancelled(); db.setTransactionSuccessful(); - listFilledOK = true; } finally { db.endTransaction(); } } - // should not be set in the DB transaction, because of a possible deadlock - // with the main and DbOpQueueRunner threads - if (listFilledOK) - Data.accounts.setList(accountList); + + profile.setAccounts(accountList); return true; }