X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Faccount_summary%2FAccountSummaryAdapter.java;h=20b72915b9224158cfb11d07d0caa3c5c71b4afa;hb=93545c6fbf1244fbd96ecfc50e1115dbdc25f9ae;hp=cc6cff1878a336620ff0df206abf2fc82a1d0d34;hpb=9a56eed6dcbfe4434a9a46b198320c16b288d86f;p=mobile-ledger.git 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 cc6cff18..20b72915 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 @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -19,7 +19,6 @@ package net.ktnx.mobileledger.ui.account_summary; import android.content.Context; import android.content.res.Resources; -import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -42,6 +41,7 @@ import net.ktnx.mobileledger.model.MobileLedgerProfile; import net.ktnx.mobileledger.ui.MainModel; import net.ktnx.mobileledger.ui.activity.MainActivity; import net.ktnx.mobileledger.utils.Locker; +import net.ktnx.mobileledger.utils.Misc; import org.jetbrains.annotations.NotNull; @@ -71,9 +71,9 @@ public class AccountSummaryAdapter if (oldType != newType) return false; - return TextUtils.equals(oldItem.getAccount() - .getName(), newItem.getAccount() - .getName()); + return Misc.equalStrings(oldItem.getAccount() + .getName(), newItem.getAccount() + .getName()); } @Override public boolean areContentsTheSame(@NotNull AccountListItem oldItem, @@ -169,7 +169,7 @@ public class AccountSummaryAdapter model.updateDisplayedAccounts(); DbOpQueue.add("update accounts set expanded=? where name=? and profile=?", - new Object[]{mAccount.isExpanded(), mAccount.getName(), profile.getUuid() + new Object[]{mAccount.isExpanded(), mAccount.getName(), profile.getId() }); } @@ -192,7 +192,7 @@ public class AccountSummaryAdapter return; DbOpQueue.add("update accounts set amounts_expanded=? where name=? and profile=?", - new Object[]{mAccount.amountsExpanded(), mAccount.getName(), profile.getUuid() + new Object[]{mAccount.amountsExpanded(), mAccount.getName(), profile.getId() }); } @@ -256,7 +256,7 @@ public class AccountSummaryAdapter break; case HEADER: - setLastUpdateText(Data.lastUpdateText.get()); + setLastUpdateText(Data.lastAccountsUpdateText.get()); break; default: throw new IllegalStateException("Unexpected value: " + newType); @@ -270,15 +270,15 @@ public class AccountSummaryAdapter if (lastUpdateObserver != null) return; - lastUpdateObserver = (o, arg) -> setLastUpdateText(Data.lastUpdateText.get()); + lastUpdateObserver = (o, arg) -> setLastUpdateText(Data.lastAccountsUpdateText.get()); - Data.lastUpdateText.addObserver(lastUpdateObserver); + Data.lastAccountsUpdateText.addObserver(lastUpdateObserver); } private void dropLastUpdateObserver() { if (lastUpdateObserver == null) return; - Data.lastUpdateText.deleteObserver(lastUpdateObserver); + Data.lastAccountsUpdateText.deleteObserver(lastUpdateObserver); lastUpdateObserver = null; } private void setType(AccountListItem.Type newType) {