String input = String.valueOf(b.accountRowAccAmounts.getText());
input = input.replace(decimalSeparator, decimalDot);
final String newText = String.format("%4.2f", Float.parseFloat(input));
- if (!newText.equals(input))
- b.accountRowAccAmounts.setText(newText);
+ 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;