]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java
drop unneeded profile parameter
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / account_summary / AccountSummaryFragment.java
index dbc200eb8f6e8ff592ae02048c9682efd8326877..174a4b2c775f0ed43fd25c3ac85bfbcfc0061800 100644 (file)
@@ -89,24 +89,21 @@ public class AccountSummaryFragment extends MobileLedgerListFragment {
 
         manageFabOnScroll();
 
-        swiper = mainActivity.findViewById(R.id.account_swiper);
+        refreshLayout = mainActivity.findViewById(R.id.account_swipe_refresh_layout);
         Colors.themeWatch.observe(getViewLifecycleOwner(), this::themeChanged);
-        swiper.setOnRefreshListener(() -> {
+        refreshLayout.setOnRefreshListener(() -> {
             debug("ui", "refreshing accounts via swipe");
             Data.scheduleTransactionListRetrieval(mainActivity);
         });
 
-        MobileLedgerProfile profile = Data.profile.getValue();
-        if (profile != null) {
-            profile.getDisplayedAccounts()
-                   .observe(getViewLifecycleOwner(),
-                           (accounts) -> onAccountsChanged(profile, accounts));
-        }
+        MobileLedgerProfile profile = Data.getProfile();
+        profile.getDisplayedAccounts()
+               .observe(getViewLifecycleOwner(), this::onAccountsChanged);
     }
-    private void onAccountsChanged(MobileLedgerProfile profile, List<LedgerAccount> accounts) {
+    private void onAccountsChanged(List<LedgerAccount> accounts) {
         Logger.debug("async-acc",
                 String.format(Locale.US, "fragment: got new account list (%d items)",
                         accounts.size()));
-        modelAdapter.setAccounts(profile, accounts);
+        modelAdapter.setAccounts(accounts);
     }
 }