From: Damyan Ivanov Date: Sun, 16 Aug 2020 13:53:21 +0000 (+0300) Subject: drop unneeded profile parameter X-Git-Tag: v0.15.0~43 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=748544f53147c7e811f8b11c081ed162a3870cb3;p=mobile-ledger.git drop unneeded profile parameter --- 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); } }