X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Faccount_summary%2FAccountSummaryFragment.java;h=fdeb54804e26471bbb2117c1736c29f7b7018fd7;hb=4f8b4f8bf16aaef182e1aac31a34f88a2adf5fa8;hp=9f2344fb605bbad3c2a09cc3a4110b9a64108592;hpb=d08ab8235d0fd152c772b2dd5ffa1ca5747f67b1;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 9f2344fb..fdeb5480 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 @@ -40,7 +40,8 @@ import net.ktnx.mobileledger.utils.Logger; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import static net.ktnx.mobileledger.utils.Logger.debug; @@ -88,22 +89,22 @@ 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); }); - Data.profile.observe(getViewLifecycleOwner(), profile -> profile.getAccounts() - .observe( - getViewLifecycleOwner(), - (accounts) -> onAccountsChanged( - profile, - accounts))); + MobileLedgerProfile profile = Data.getProfile(); + profile.getDisplayedAccounts() + .observe(getViewLifecycleOwner(), + (accounts) -> onAccountsChanged(profile, accounts)); } - private void onAccountsChanged(MobileLedgerProfile profile, ArrayList accounts) { - Logger.debug("async-acc", "fragment: got new account list"); + private void onAccountsChanged(MobileLedgerProfile profile, List accounts) { + Logger.debug("async-acc", + String.format(Locale.US, "fragment: got new account list (%d items)", + accounts.size())); modelAdapter.setAccounts(profile, accounts); } }