/*
- * 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
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;
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;
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,
else
currValue = curr;
- if (!significantChange && !TextUtils.equals(acc.getCurrency(), currValue))
+ if (!significantChange && !Misc.equalStrings(acc.getCurrency(), currValue))
significantChange = true;
acc.setCurrency(currValue);
}
final String incomingAccountName = acc.getAccountName();
final String presentAccountName = String.valueOf(b.accountRowAccName.getText());
- if (!TextUtils.equals(incomingAccountName, presentAccountName)) {
+ if (!Misc.equalStrings(incomingAccountName, presentAccountName)) {
Logger.debug("bind",
String.format("Setting account name from '%s' to '%s' (| @ %d)",
presentAccountName, incomingAccountName,
if (item == receiver) {
final String hint = String.format("%1.2f", -currencyBalance);
if (!acc.isAmountHintSet() ||
- !TextUtils.equals(acc.getAmountHint(), hint))
+ !Misc.equalStrings(acc.getAmountHint(), hint))
{
Logger.debug("submittable",
String.format("Setting amount hint of {%s} to %s [%s]",
return false;
return Objects.equals(date, other.date) &&
- TextUtils.equals(description, other.description) &&
- TextUtils.equals(comment, other.comment);
+ Misc.equalStrings(description, other.description) &&
+ Misc.equalStrings(comment, other.comment);
}
}
if (other == null)
return false;
- boolean equal = TextUtils.equals(accountName, other.accountName);
- equal = equal && TextUtils.equals(comment, other.comment) &&
+ boolean equal = Misc.equalStrings(accountName, other.accountName);
+ equal = equal && Misc.equalStrings(comment, other.comment) &&
(amountSet ? other.amountSet && amount == other.amount : !other.amountSet);
// compare amount hint only if there is no amount
if (!amountSet)
equal = equal && (amountHintIsSet ? other.amountHintIsSet &&
- TextUtils.equals(amountHint, other.amountHint)
+ Misc.equalStrings(amountHint, other.amountHint)
: !other.amountHintIsSet);
- equal = equal && TextUtils.equals(currency, other.currency) && isLast == other.isLast;
+ equal = equal && Misc.equalStrings(currency, other.currency) && isLast == other.isLast;
Logger.debug("new-trans",
String.format("Comparing {%s} and {%s}: %s", this.toString(), other.toString(),