try {
String input = String.valueOf(b.accountRowAccAmounts.getText());
input = input.replace(decimalSeparator, decimalDot);
- b.accountRowAccAmounts.setText(
- String.format("%4.2f", Float.parseFloat(input)));
+ final String newText = String.format("%4.2f", Float.parseFloat(input));
+ if (!newText.equals(input)) {
+ boolean wasSyncingData = syncingData;
+ syncingData = true;
+ try {
+ b.accountRowAccAmounts.setText(newText);
+ }
+ finally {
+ syncingData = wasSyncingData;
+ }
+ }
}
catch (NumberFormatException ex) {
// ignored
b.currencyButton.setOnClickListener(v -> {
CurrencySelectorFragment cpf = new CurrencySelectorFragment();
cpf.showPositionAndPadding();
- cpf.setOnCurrencySelectedListener(
- c -> adapter.setItemCurrency(getAdapterPosition(), c.getName()));
+ cpf.setOnCurrencySelectedListener(c -> adapter.setItemCurrency(getAdapterPosition(),
+ (c == null) ? null : c.getName()));
cpf.show(activity.getSupportFragmentManager(), "currency-selector");
});
return false;
}
+ if (getAdapterPosition() < 0) {
+ // probably the row was swiped out
+ Logger.debug("new-trans", "Ignoring request to suncData(): adapter position negative");
+ return false;
+ }
+
NewTransactionModel.Item item = getItem();
syncingData = true;
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,