]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java
fix merging of account lists so that changes are detected
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / ui / account_summary / AccountSummaryAdapter.java
index fbbc47d7ff5080647b7a7f4e6994dcc48283fa56..2d7ea6ed6e3a8404749a781077b49d1ae4fd19de 100644 (file)
@@ -39,17 +39,18 @@ import net.ktnx.mobileledger.model.LedgerAccount;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
 import net.ktnx.mobileledger.ui.activity.MainActivity;
 import net.ktnx.mobileledger.utils.Locker;
+import net.ktnx.mobileledger.utils.Logger;
 
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
+import java.util.Locale;
 
 import static net.ktnx.mobileledger.utils.Logger.debug;
 
 public class AccountSummaryAdapter
         extends RecyclerView.Adapter<AccountSummaryAdapter.LedgerRowHolder> {
     public static final int AMOUNT_LIMIT = 3;
-    private MobileLedgerProfile profile;
     private AsyncListDiffer<LedgerAccount> listDiffer;
     AccountSummaryAdapter() {
         listDiffer = new AsyncListDiffer<>(this, new DiffUtil.ItemCallback<LedgerAccount>() {
@@ -84,8 +85,7 @@ public class AccountSummaryAdapter
         return listDiffer.getCurrentList()
                          .size();
     }
-    public void setAccounts(MobileLedgerProfile profile, List<LedgerAccount> newList) {
-        this.profile = profile;
+    public void setAccounts(List<LedgerAccount> newList) {
         listDiffer.submitList(newList);
     }
     static class LedgerRowHolder extends RecyclerView.ViewHolder {
@@ -189,6 +189,7 @@ public class AccountSummaryAdapter
             return true;
         }
         public void bindToAccount(LedgerAccount acc) {
+            Logger.debug("accounts", String.format(Locale.US, "Binding to '%s'", acc.getName()));
             Context ctx = row.getContext();
             Resources rm = ctx.getResources();
             mAccount = acc;