- Data.accounts.addObserver(
- (o, arg) -> mainActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged()));
+ MobileLedgerProfile profile = Data.getProfile();
+ profile.getDisplayedAccounts()
+ .observe(getViewLifecycleOwner(),
+ (accounts) -> onAccountsChanged(profile, accounts));
+ }
+ private void onAccountsChanged(MobileLedgerProfile profile, List<LedgerAccount> accounts) {
+ Logger.debug("async-acc",
+ String.format(Locale.US, "fragment: got new account list (%d items)",
+ accounts.size()));
+ modelAdapter.setAccounts(profile, accounts);