From 748544f53147c7e811f8b11c081ed162a3870cb3 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 16 Aug 2020 16:53:21 +0300 Subject: [PATCH] drop unneeded profile parameter --- .../ui/account_summary/AccountSummaryAdapter.java | 4 +--- .../ui/account_summary/AccountSummaryFragment.java | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java index fbbc47d7..5ffc62f5 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java @@ -49,7 +49,6 @@ import static net.ktnx.mobileledger.utils.Logger.debug; public class AccountSummaryAdapter extends RecyclerView.Adapter { public static final int AMOUNT_LIMIT = 3; - private MobileLedgerProfile profile; private AsyncListDiffer listDiffer; AccountSummaryAdapter() { listDiffer = new AsyncListDiffer<>(this, new DiffUtil.ItemCallback() { @@ -84,8 +83,7 @@ public class AccountSummaryAdapter return listDiffer.getCurrentList() .size(); } - public void setAccounts(MobileLedgerProfile profile, List newList) { - this.profile = profile; + public void setAccounts(List newList) { listDiffer.submitList(newList); } static class LedgerRowHolder extends RecyclerView.ViewHolder { 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 fdeb5480..174a4b2c 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 @@ -98,13 +98,12 @@ public class AccountSummaryFragment extends MobileLedgerListFragment { MobileLedgerProfile profile = Data.getProfile(); profile.getDisplayedAccounts() - .observe(getViewLifecycleOwner(), - (accounts) -> onAccountsChanged(profile, accounts)); + .observe(getViewLifecycleOwner(), this::onAccountsChanged); } - private void onAccountsChanged(MobileLedgerProfile profile, List accounts) { + private void onAccountsChanged(List 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); } } -- 2.39.5