X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Faccount_summary%2FAccountSummaryFragment.java;h=8ad6da6ff0fa7233613d1ffaa53fd694e99d805e;hb=faa01b22a0f23efe6302d4787c244bb4f241b8da;hp=9d9c2c64bc4c1689facb75b83775811c62d67663;hpb=8098a8b37a4331b9faf6cf50a51a0d7aa9677421;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java index 9d9c2c64..8ad6da6f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java @@ -34,6 +34,7 @@ import androidx.recyclerview.widget.RecyclerView; import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.db.AccountWithAmounts; import net.ktnx.mobileledger.db.DB; +import net.ktnx.mobileledger.db.Profile; import net.ktnx.mobileledger.model.AccountListItem; import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.model.LedgerAccount; @@ -104,10 +105,15 @@ public class AccountSummaryFragment extends MobileLedgerListFragment { model.scheduleTransactionListRetrieval(); }); + Data.observeProfile(this, this::onProfileChanged); + } + private void onProfileChanged(Profile profile) { + if (profile == null) + return; + DB.get() .getAccountDAO() - .getAllWithAmounts(Data.getProfile() - .getId()) + .getAllWithAmounts(profile.getId()) .observe(getViewLifecycleOwner(), list -> AsyncTask.execute(() -> { List adapterList = new ArrayList<>(); adapterList.add(new AccountListItem.Header(Data.lastAccountsUpdateText));