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))
+ b.accountRowAccAmounts.setText(newText);
}
catch (NumberFormatException ex) {
// ignored
if (showCurrency) {
b.currency.setVisibility(View.VISIBLE);
b.currencyButton.setVisibility(View.VISIBLE);
- b.currency.setText(mProfile.getDefaultCommodity());
+ setCurrencyString(mProfile.getDefaultCommodity());
}
else {
b.currency.setVisibility(View.GONE);
b.currencyButton.setVisibility(View.GONE);
- b.currency.setText(null);
+ setCurrencyString(null);
}
});
private void setCurrencyString(String currency) {
@ColorInt int textColor = b.dummyText.getTextColors()
.getDefaultColor();
- if ((currency == null) || currency.isEmpty()) {
+ if (TextUtils.isEmpty(currency)) {
b.currency.setText(R.string.currency_symbol);
int alpha = (textColor >> 24) & 0xff;
alpha = alpha * 3 / 4;
try {
b.accountRowAccName.setAdapter(null);
b.accountRowAccName.setText(incomingAccountName);
- if (b.accountRowAccName.hasFocus())
- b.accountRowAccName.setSelection(
- acc.getAccountNameCursorPosition());
+ b.accountRowAccName.setSelection(acc.getAccountNameCursorPosition());
}
finally {
b.accountRowAccName.setAdapter(a);